3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function errorHandler() { return false; } function crash() { $stuff = array('aaa', 'bbb'); foreach ($stuff as $thing) { $thing[(object)array()] = 'w'; } print_r($stuff); if ($stuff[0] == 'aaa') { die(0); } else { die(1); } }; set_error_handler('errorHandler', E_WARNING); crash();
Output for 5.2.0 - 5.2.17, 5.3.25 - 5.3.29, 5.4.15 - 7.1.0
Warning: Illegal offset type in /in/pIMSh on line 12 Notice: Object of class stdClass could not be converted to int in /in/pIMSh on line 12 Warning: Illegal offset type in /in/pIMSh on line 12 Notice: Object of class stdClass could not be converted to int in /in/pIMSh on line 12 Array ( [0] => aaa [1] => bbb )
Output for 5.4.0 - 5.4.14
Warning: Illegal offset type in /in/pIMSh on line 12 Notice: Object of class stdClass could not be converted to int in /in/pIMSh on line 12 Warning: Illegal offset type in /in/pIMSh on line 12 Notice: Object of class stdClass could not be converted to int in /in/pIMSh on line 12 Array ( [0] => [1] => bbb )
Process exited with code 1.
Output for 5.3.0 - 5.3.24
Warning: Illegal offset type in /in/pIMSh on line 12 Notice: Object of class stdClass could not be converted to int in /in/pIMSh on line 12 Warning: Illegal offset type in /in/pIMSh on line 12 Notice: Object of class stdClass could not be converted to int in /in/pIMSh on line 12 Array ( [0] => 1! [1] => bbb )
Process exited with code 139.
Output for 5.1.0 - 5.1.6
Notice: Object of class stdClass could not be converted to int in /in/pIMSh on line 12 Notice: Object of class stdClass could not be converted to int in /in/pIMSh on line 12 Array ( [0] => aaa [1] => bbb )
Output for 5.0.0 - 5.0.5
Array ( [0] => aaa [1] => bbb )
Output for 4.3.0 - 4.4.9
Warning: Wrong parameter count for set_error_handler() in /in/pIMSh on line 22 Array ( [0] => aaa [1] => bbb )