3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function lint($code) { $code = strpos($code, '<?php') === 0 ? $code : "<?php $code"; $filename = tempnam(sys_get_temp_dir(), 'lnt'); file_put_contents($filename, $code); exec(PHP_BINARY . " -l $filename", $errors); return $errors; } print_r( lint('echo "world"; } ') );
Output for 5.4.0 - 5.6.28, 7.0.0 - 7.1.0
Array ( )
Output for hhvm-3.12.0
Array ( [0] => Failed to exec: `/usr/bin/hhvm-3.12.0 -l /tmp/lntsKLaUQ' )
Output for hhvm-3.10.0
Array ( [0] => Failed to exec: `/usr/bin/hhvm-3.10.0 -l /tmp/lnt1YscbR' )
Output for 5.2.1 - 5.3.29
Notice: Use of undefined constant PHP_BINARY - assumed 'PHP_BINARY' in /in/q8UvF on line 7 Array ( )
Output for 5.0.0 - 5.2.0
Fatal error: Call to undefined function sys_get_temp_dir() in /in/q8UvF on line 5
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: sys_get_temp_dir() in /in/q8UvF on line 5
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: sys_get_temp_dir() in /in/q8UvF on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: sys_get_temp_dir() in /in/q8UvF on line 5