title: Is it possible to change data type inside a SimpleXMLElement object with PHP?
body: <p>I have this object</p>
  
  <pre><code>$data = simplexml_load_string('&lt;xml&gt;&lt;admin&gt;0&lt;/admin&gt;&lt;/xml&gt;');
  </code></pre>
  
  <p>where $data->admin = "0" <code>(string)</code>. So with a string 0, the following would always return true</p>
  
  <pre><code>if($data-&gt;admin) {
      echo 'is admin';
  }
  </code></pre>
  
  <p>By casting the variable, this would work correctly</p>
  
  <pre><code>if((int)$data-&gt;admin) {
      echo 'is admin';
  }
  </code></pre>
  
  <p>But I'm still wondering if it's possible to change the data type inside the object (like doing so inside an array) so I don't have to do type casting.</p>