- var_dump: documentation ( source)
<?php
class UberSimpleXML extends SimpleXMLElement {
public function __toString() {
return 'stringification';
}
}
$xml = new UberSimpleXML('<xml/>');
$xml->tag = "you're it!";
echo "\nno cast\n";
echo $xml;
echo "\ncast\n";
echo (string) $xml;
echo "\nexplicit call\n";
echo $xml->__toString();
echo "\n";
var_dump((string) $xml);
var_dump($xml->__toString());