I have this object
$data = simplexml_load_string('<xml><admin>0</admin></xml>');
where $data->admin = "0" (string)
. So with a string 0, the following would always return true
if($data->admin) {
echo 'is admin';
}
By casting the variable, this would work correctly
if((int)$data->admin) {
echo 'is admin';
}
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.