3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $obj1 = (object) "hello1"; $obj1->gg = 'world1'; $obj2 = (object) "hello2"; $obj2->gg = 'world1'; $obj3 = (object) "hello3"; $obj3->gg = 'world3'; $arr = array(); $arr[0] = $obj1; $arr[1] = $obj2; $arr[2] = $obj3; //$arr = array_map("unserialize", array_unique(array_map("serialize", (array) $arr))); $res = array_unique(array_map(function ((array) $arr) { return $arr['gg']; }, $holder)); print_r($res);
Output for 5.6.8
Parse error: syntax error, unexpected '(array)' (array) (T_ARRAY_CAST), expecting variable (T_VARIABLE) in /in/M8XZU on line 19
Process exited with code 255.
Output for 5.4.0 - 5.5.24
Parse error: syntax error, unexpected '(array)' (array) (T_ARRAY_CAST), expecting '&' or variable (T_VARIABLE) in /in/M8XZU on line 19
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_ARRAY_CAST, expecting '&' or T_VARIABLE in /in/M8XZU on line 19
Process exited with code 255.