- var_dump: documentation ( source)
<?php
class Primary {
public function __toString() {
$GLOBALS['anObject'] = $this;
var_dump('toString called');
return 'toString output from Primary';
}
}
$Foo = new Primary;
// no-op, execute __toString
''.$Foo;
// expected to be object of class Primary, actually string
var_dump($GLOBALS['anObject']);