3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = 3; $b = 1.55; $c = $a + $b; echo $c . PHP_EOL; // prints 4.55 $d = new \SplFloat(3.00); $e = new \SplFloat(1.55); $f = $d + $e; echo $f . PHP_EOL; // prints 4 (unexpected) $g = new \SplFloat(3.00); $h = new \SplFloat(1.55); $i = (float)$g + (float)$h; echo $i . PHP_EOL; // prints 4.55
based on lVjTn
Output for 7.0.0 - 7.1.0
4.55 Fatal error: Uncaught Error: Class 'SplFloat' not found in /in/tCNIa:7 Stack trace: #0 {main} thrown in /in/tCNIa on line 7
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
4.55 Fatal error: Class undefined: SplFloat in /in/tCNIa on line 7
Process exited with code 255.
Output for 5.3.0 - 5.6.28
4.55 Fatal error: Class 'SplFloat' not found in /in/tCNIa on line 7
Process exited with code 255.
Output for 5.0.2 - 5.0.5, 5.1.1 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 12 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 13 4.55 Fatal error: Class 'SplFloat' not found in /in/tCNIa on line 7
Process exited with code 255.
Output for 5.1.0
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 12 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 13 Fatal error: fatal flex scanner internal error--end of buffer missed in /in/tCNIa on line 15
Process exited with code 255.
Output for 5.0.0 - 5.0.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 12 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 13 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/tCNIa on line 5 4.55PHP_EOL Fatal error: Class 'SplFloat' not found in /in/tCNIa on line 7
Process exited with code 255.
Output for 4.3.10 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 12 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 13 4.55 Fatal error: Cannot instantiate non-existent class: splfloat in /in/tCNIa on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 12 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 13 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/tCNIa on line 5 4.55PHP_EOL Fatal error: Cannot instantiate non-existent class: splfloat in /in/tCNIa on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 7 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 8 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 12 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tCNIa on line 13 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/tCNIa on line 5 4.55PHP_EOL Fatal error: Cannot instantiate non-existent class: splfloat in /in/tCNIa on line 7