title: Can I change the variable type from object to string?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2469222/how-to-convert-object-into-string-in-php">how to convert object into string in php</a>  </p>
  </blockquote>
  
  
  
  <p>I have a variable that contain some object (SimpleXML).<br>
  Can I change the type of this variable, and to assing it to this variable itself?<br>
  Like this:  </p>
  
  <pre><code>$test = (string)$test;
  var_dump($test);
  </code></pre>
  
  <p>The above code does not work, so the output is still <code>object(SimpleXMLElement)</code> and not a <code>string</code>.</p>
  
  <p>But when I assign it another variable, like <code>$new_test = (string)$test</code> it works well, and the var_dump output is <code>string</code>]</p>