3v4l.org

run code in 300+ PHP versions simultaneously
<?php function my_unserialize($data) { $array = unserialize($data); if(!is_array($array)) { $array = array(); } return $array; } $_GET['ryat'] = 'ryat'; $ryat = ''; class ryat { function __construct($array) { foreach($array as $key => $val) { $key = $val; } } $a = new ryat(); $str = 'O:4:"ryat":0:{}'; serialize($a);
Output for 5.4.0 - 5.4.25, 5.5.0 - 5.5.9
Parse error: syntax error, unexpected '$a' (T_VARIABLE), expecting function (T_FUNCTION) in /in/psX3A on line 25
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /in/psX3A on line 25
Process exited with code 255.

preferences:
194.71 ms | 1395 KiB | 72 Q