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) { $key = $val; var_dump($array); } } } $a = new ryat($GLOBALS = array('ryat'=>'ryat')); $str = 'O:4:"ryat":0:{}'; echo $ryat; echo(serialize($a));
Output for 5.0.0 - 7.1.0
array(1) { ["ryat"]=> string(4) "ryat" } O:4:"ryat":0:{}
Output for 4.3.0 - 4.4.9
O:4:"ryat":0:{}