var_export() With Stdclass¶
PHP used to export stdClass objects like other classes, with a call to the magic method __set_state(). Since PHP 7.2, it does the export with the cast of an array to (object). This is more readable, and acknowledge the absence of such method for stdClass.
PHP code¶
<?php
var_export(new stdClass);
?>
Before¶
stdClass::__set_state(array())
After¶
(object) array()
PHP version change¶
This behavior changed in 7.2