3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $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(), SEPARATION); saveRawValue('ii.runtime_group', posix_getgid(), SEPARATION); echo "<pre>" . json_encode($output) . "</pre>";
based on vDhWt
Output for 5.2.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Use of undefined constant SEPARATION - assumed 'SEPARATION' in /in/KrTUA on line 35 Notice: Use of undefined constant SEPARATION - assumed 'SEPARATION' in /in/KrTUA on line 36 <pre>{"phpinfo":[],"ii.runtime_user":99,"ii.runtime_group":99}</pre>
Output for hhvm-3.12.0
Notice: Use of undefined constant SEPARATION - assumed 'SEPARATION' in /in/KrTUA on line 35 Notice: Use of undefined constant SEPARATION - assumed 'SEPARATION' in /in/KrTUA on line 36 <pre>{"phpinfo":{"Version":{"Version":["3.12.0","Version ID"]},"INI":{"allow_url_fopen":["1","apc.enable_cli"],"hhvm.admin_server.port":["0","hhvm.admin_server.thread_count"],"hhvm.debug.clear_input_on_success":["1","hhvm.debug.core_dump_email"],"hhvm.emit_switch":["1","hhvm.enable_alternative"],"hhvm.error_handling.call_user_handler_on_fatals":["1","hhvm.error_handling.enable_hip_hop_errors"],"hhvm.external_emitter_fallback":["0","hhvm.fail_jit_prologs"],"hhvm.pid_file":["www.pid","hhvm.preg.backtrace_limit"],"hhvm.proxy.retry":["3","hhvm.proxy.serve_urls"],"hhvm.region_relax_guards":["1","hhvm.repo.authoritative"],"hhvm.server.add_vary_encoding":["1","hhvm.server.allow_duplicate_cookies"],"hhvm.server.apc.enable_apc":["1","hhvm.server.apc.enable_apc_serialize"],"hhvm.server.apc.purge_frequency":["4096","hhvm.server.apc.purge_rate"],"hhvm.server.graceful_shutdown_wait":["0","hhvm.server.gzip_compression_level"],"hhvm.server.image_memory_max_bytes":["209715200","hhvm.server.implicit_flush"],"hhvm.server.lib_event_sync_send":["1","hhvm.server.light_process_count"],"hhvm.server.ssl_port":["443","hhvm.server.startup_document"],"hhvm.server.warmup_throttle_request_count":["0","hhvm.server.warn_on_collection_to_array"],"hhvm.stats.enable_hot_profiler":["1","hhvm.stats.max_slot"]},"$_SERVER":{"TERM":["xterm","PATH"],"argc":["1","PWD"]},"$_ENV":{"TERM":["xterm","PATH"]}},"ii.runtime_user":99,"ii.runtime_group":99}</pre>
Output for hhvm-3.10.0
Notice: Use of undefined constant SEPARATION - assumed 'SEPARATION' in /in/KrTUA on line 35 Notice: Use of undefined constant SEPARATION - assumed 'SEPARATION' in /in/KrTUA on line 36 <pre>{"phpinfo":{"Version":{"Version":["3.10.0","Version ID"]},"INI":{"allow_url_fopen":["1","apc.enable_cli"],"hhvm.admin_server.port":["0","hhvm.admin_server.thread_count"],"hhvm.debug.clear_input_on_success":["1","hhvm.debug.core_dump_email"],"hhvm.eager_gc_probability":["0","hhvm.emit_new_m_instrs"],"hhvm.error_handling.call_user_handler_on_fatals":["1","hhvm.error_handling.enable_hip_hop_errors"],"hhvm.external_emitter_fallback":["0","hhvm.force_hh"],"hhvm.pid_file":["www.pid","hhvm.preg.backtrace_limit"],"hhvm.proxy.retry":["3","hhvm.proxy.serve_urls"],"hhvm.region_relax_guards":["1","hhvm.repo.authoritative"],"hhvm.server.add_vary_encoding":["1","hhvm.server.allow_duplicate_cookies"],"hhvm.server.apc.enable_apc":["1","hhvm.server.apc.enable_apc_serialize"],"hhvm.server.apc.purge_frequency":["4096","hhvm.server.apc.purge_rate"],"hhvm.server.graceful_shutdown_wait":["0","hhvm.server.gzip_compression_level"],"hhvm.server.image_memory_max_bytes":["209715200","hhvm.server.implicit_flush"],"hhvm.server.lib_event_sync_send":["1","hhvm.server.light_process_count"],"hhvm.server.ssl_port":["443","hhvm.server.startup_document"],"hhvm.server.warmup_throttle_request_count":["0","hhvm.server.warn_on_collection_to_array"],"hhvm.stats.enable_hot_profiler":["1","hhvm.stats.max_slot"]},"$_SERVER":{"TERM":["xterm","PATH"],"argc":["1","PWD"]},"$_ENV":{"TERM":["xterm","PATH"]}},"ii.runtime_user":99,"ii.runtime_group":99}</pre>
Output for 5.0.0 - 5.1.6
Notice: Use of undefined constant SEPARATION - assumed 'SEPARATION' in /in/KrTUA on line 35 Notice: Use of undefined constant SEPARATION - assumed 'SEPARATION' in /in/KrTUA on line 36 Fatal error: Call to undefined function json_encode() in /in/KrTUA on line 39
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Notice: Use of undefined constant SEPARATION - assumed 'SEPARATION' in /in/KrTUA on line 35 Notice: Use of undefined constant SEPARATION - assumed 'SEPARATION' in /in/KrTUA on line 36 Fatal error: Call to undefined function: json_encode() in /in/KrTUA on line 39
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Notice: Use of undefined constant SEPARATION - assumed 'SEPARATION' in /in/KrTUA on line 35 Notice: Use of undefined constant SEPARATION - assumed 'SEPARATION' in /in/KrTUA on line 36 Fatal error: Call to undefined function: json_encode() in /in/KrTUA on line 39
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant SEPARATION - assumed 'SEPARATION' in /in/KrTUA on line 35 Notice: Use of undefined constant SEPARATION - assumed 'SEPARATION' in /in/KrTUA on line 36 Fatal error: Call to undefined function: json_encode() in /in/KrTUA on line 39