3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $name = 'aresa'; $value = 'someValue'; $user_id = 'someID'; echo '1-->'; var_dump("\n[start]" . time() . "|$name|$value|$user_id" . '[end]'); // this derefers $user_id somehow (end it probably evaled to false (which is 0) so $user_id[0] echo '2-->'; var_dump(PHP_EOL . '[start]' . time() . '|' . $name . '|' . $value . '|' . $user_id . '[end]'); class Foo { public function bar($name = '', $value = '', $user_id = '') { $inputString = "\n[start]" . time() . "|$name|$value|$user_id" . '[end]'; echo '3-->'; var_dump($inputString); } } $x = new Foo; $x->bar($name, $value, $user_id);
based on LDiiY
Output for 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
1-->string(46) " [start]1409394916|aresa|someValue|someID[end]" 2-->string(46) " [start]1409394916|aresa|someValue|someID[end]" 3-->string(46) " [start]1409394916|aresa|someValue|someID[end]"
Output for 5.0.0 - 5.0.1
1-->string(46) " [start]1409394916|aresa|someValue|someID[end]" 2--> Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/NhCiP on line 8 string(52) "PHP_EOL[start]1409394916|aresa|someValue|someID[end]" 3-->string(46) " [start]1409394916|aresa|someValue|someID[end]"
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/NhCiP on line 11
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/NhCiP on line 11
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/NhCiP on line 11
Process exited with code 255.