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 = 'a'; class ryat { function __construct($array) { foreach($array as $key => $val) { $key = $val; var_dump($key); } } } $a = new ryat($array = array('GLOBALS'=>array('ryat'=>'ryat'))); $str = 'O:4:"ryat":0:{}'; echo $ryat; echo(serialize($a));
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(1) { ["ryat"]=> string(4) "ryat" } aO:4:"ryat":0:{}
Output for 4.3.0 - 4.4.9
aO:4:"ryat":0:{}