3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; $arrK = array_combine($arr, array_fill(0, count($arr), true)); $iters = 1_000_000; $t = microtime(true); for ($i = 0; $i < $iters; $i++) { $v = ($i % 2) ? 'a' : 'c'; $res = in_array($v, $arr); $res = in_array($v, $arr); $res = in_array($v, $arr); $res = in_array($v, $arr); } var_dump(microtime(true) - $t); $t = microtime(true); for ($i = 0; $i < $iters; $i++) { $v = ($i % 2) ? 'a' : 'c'; $res = array_key_exists($v, $arrK); $res = array_key_exists($v, $arrK); $res = array_key_exists($v, $arrK); $res = array_key_exists($v, $arrK); } var_dump(microtime(true) - $t); $t = microtime(true); for ($i = 0; $i < $iters; $i++) { $v = ($i % 2) ? 'a' : 'c'; $res = array_key_exists($v, array_keys($arr)); $res = array_key_exists($v, array_keys($arr)); $res = array_key_exists($v, array_keys($arr)); $res = array_key_exists($v, array_keys($arr)); } var_dump(microtime(true) - $t); print_r(opcache_get_status());
Output for git.master
float(0.10884499549865723) float(0.0714731216430664) float(0.30828213691711426)
Output for git.master_jit
float(0.10722017288208008) float(0.0714869499206543) float(0.30631113052368164) Array ( [opcache_enabled] => 1 [cache_full] => [restart_pending] => [restart_in_progress] => [memory_usage] => Array ( [used_memory] => 869576 [free_memory] => 7519032 [wasted_memory] => 0 [current_wasted_percentage] => 0 ) [opcache_statistics] => Array ( [num_cached_scripts] => 0 [num_cached_keys] => 0 [max_cached_keys] => 16229 [hits] => 0 [start_time] => 1677856746 [last_restart_time] => 0 [oom_restarts] => 0 [hash_restarts] => 0 [manual_restarts] => 0 [misses] => 1 [blacklist_misses] => 0 [blacklist_miss_ratio] => 0 [opcache_hit_rate] => 0 ) [scripts] => Array ( ) [jit] => Array ( [enabled] => 1 [on] => 1 [kind] => 5 [opt_level] => 4 [opt_flags] => 6 [buffer_size] => 8388592 [buffer_free] => 8386096 ) )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
33.1 ms | 410 KiB | 5 Q