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:{}'; echo(serialize($a));
Output for 5.4.0 - 5.4.25
Parse error: syntax error, unexpected '$a' (T_VARIABLE), expecting function (T_FUNCTION) in /in/truER 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/truER on line 25
Process exited with code 255.

preferences:
180.46 ms | 1395 KiB | 62 Q