3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('log_errors', 0); $output = array(); function saveRawValue($name, $value) { $GLOBALS['output'][$name] = $value; } function parse_phpinfo() { ob_start(); phpinfo(); $s = ob_get_contents(); ob_end_clean(); $s = strip_tags($s, '<h2><th><td>'); $s = preg_replace('/<th[^>]*>([^<]+)<\/th>/', '<info>\1</info>', $s); $s = preg_replace('/<td[^>]*>([^<]+)<\/td>/', '<info>\1</info>', $s); $t = preg_split('/(<h2[^>]*>[^<]+<\/h2>)/', $s, -1, PREG_SPLIT_DELIM_CAPTURE); $r = array(); $count = count($t); $p1 = '<info>([^<]+)<\/info>'; $p2 = '/'.$p1.'\s*'.$p1.'\s*'.$p1.'/'; $p3 = '/'.$p1.'\s*'.$p1.'/'; for ($i = 1; $i < $count; $i++) { if (preg_match('/<h2[^>]*>([^<]+)<\/h2>/', $t[$i], $matchs)) { $name = trim($matchs[1]); $vals = explode("\n", $t[$i + 1]); foreach ($vals AS $val) { if (preg_match($p2, $val, $matchs)) { // 3cols $r[$name][trim($matchs[1])] = array(trim($matchs[2]), trim($matchs[3])); } elseif (preg_match($p3, $val, $matchs)) { // 2cols $r[$name][trim($matchs[1])] = trim($matchs[2]); } } } } return $r; } saveRawValue('phpinfo', parse_phpinfo()); saveRawValue('ii.runtime_user', posix_getuid()); saveRawValue('ii.runtime_group', posix_getgid()); echo "<pre>" . json_encode($output) . "</pre>";
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Call to undefined function phpinfo() in /in/OLcFf:12 Stack trace: #0 /in/OLcFf(37): parse_phpinfo() #1 {main} thrown in /in/OLcFf on line 12
Process exited with code 255.
Output for 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.13
<pre>{"phpinfo":[],"ii.runtime_user":99,"ii.runtime_group":99}</pre>
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Call to undefined function json_encode() in /in/OLcFf on line 42
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_encode() in /in/OLcFf on line 42
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: json_encode() in /in/OLcFf on line 42
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_encode() in /in/OLcFf on line 42

preferences:
238.28 ms | 401 KiB | 395 Q