3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Shit { public static function getShits() { return array( new Shit, new Shit, new Shit ); } public function getTird() { return 'sucks'; } public function getPoopies() { return range(0,10); } } $shits = array(); foreach(Shit::getShits() as $shit) { $shits[] = array( 'tird' => $shit->getTird(), 'fuck' => array_map(function($val) { return $val . ' sucks'; }, $shit->getPoopies()) ); } var_dump($shits);
Output for 5.3.0 - 7.1.0
array(3) { [0]=> array(2) { ["tird"]=> string(5) "sucks" ["fuck"]=> array(11) { [0]=> string(7) "0 sucks" [1]=> string(7) "1 sucks" [2]=> string(7) "2 sucks" [3]=> string(7) "3 sucks" [4]=> string(7) "4 sucks" [5]=> string(7) "5 sucks" [6]=> string(7) "6 sucks" [7]=> string(7) "7 sucks" [8]=> string(7) "8 sucks" [9]=> string(7) "9 sucks" [10]=> string(8) "10 sucks" } } [1]=> array(2) { ["tird"]=> string(5) "sucks" ["fuck"]=> array(11) { [0]=> string(7) "0 sucks" [1]=> string(7) "1 sucks" [2]=> string(7) "2 sucks" [3]=> string(7) "3 sucks" [4]=> string(7) "4 sucks" [5]=> string(7) "5 sucks" [6]=> string(7) "6 sucks" [7]=> string(7) "7 sucks" [8]=> string(7) "8 sucks" [9]=> string(7) "9 sucks" [10]=> string(8) "10 sucks" } } [2]=> array(2) { ["tird"]=> string(5) "sucks" ["fuck"]=> array(11) { [0]=> string(7) "0 sucks" [1]=> string(7) "1 sucks" [2]=> string(7) "2 sucks" [3]=> string(7) "3 sucks" [4]=> string(7) "4 sucks" [5]=> string(7) "5 sucks" [6]=> string(7) "6 sucks" [7]=> string(7) "7 sucks" [8]=> string(7) "8 sucks" [9]=> string(7) "9 sucks" [10]=> string(8) "10 sucks" } } }
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/KSZnt on line 21
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/KSZnt on line 21
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/KSZnt on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/KSZnt on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/KSZnt on line 3
Process exited with code 255.