3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function my_unserialize($data) { $array = unserialize($data); if(!is_array($array)) { $array = array(); } return $array; } $ryat = ''; class ryat { function __construct($array) { foreach($array as $key => $val) { $array[$key] = $val; } } } $a = new ryat($GLOBALS['ryat']); $str = 'O:4:"ryat":0:{}'; echo $ryat; echo(serialize($a));
Output for 5.0.0 - 5.6.21, 7.0.0 - 7.1.0
Warning: Invalid argument supplied for foreach() in /in/Iikvb on line 19 O:4:"ryat":0:{}
Output for hhvm-3.10.0 - 3.12.0
Warning: Invalid argument supplied for foreach() in /in/Iikvb on line 21 O:4:"ryat":0:{}
Output for 4.3.0 - 4.4.9
O:4:"ryat":0:{}