3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo "The 'Wee, inline callables are sort of function things' "; class q {function foo($str) {return 'moo '.$str; } } var_dump(([new q, 'foo'])('cow')); echo "The 'Wow, we can just quote anything now'"; function bar( ) { return 'cow'; } var_dump('bar'( )); echo "The 'I'm amazed PHP doesn't mess this up' "; foreach ($Array = [[12 => 'Moo'], [13 => 'Cow']] as $Array) { var_dump($Array); } echo "The 'PHP Variables MUST NOT contain some symbols... for very soft values of MUST NOT' "; ${'$0a'} = 12; ${'0a'} = 13; var_dump(${'$0a'}); var_dump(${'0a'}); // $0a is invalid and $$0a is even more invalid, with spinkles echo "The 'Good luck and thanks for all the cows' "; @var_dump(0x2&${$Array=['cow'=>3]}['cow']); echo "The 'Hurrah BC breaks, if your program broke because of this you're a bad person' "; list($a[],$a[])=$a=[1,2]; var_dump($a);
based on feRGl
Output for hhvm-3.15.4, 7.0.0 - 7.3.0alpha1
The 'Wee, inline callables are sort of function things' string(7) "moo cow" The 'Wow, we can just quote anything now'string(3) "cow" The 'I'm amazed PHP doesn't mess this up' array(1) { [12]=> string(3) "Moo" } array(1) { [13]=> string(3) "Cow" } The 'PHP Variables MUST NOT contain some symbols... for very soft values of MUST NOT' int(12) int(13) The 'Good luck and thanks for all the cows' int(2) The 'Hurrah BC breaks, if your program broke because of this you're a bad person' array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(1) [3]=> int(2) }
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected '(' in /in/Xp12H on line 4
Process exited with code 255.