3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 'foo' => 'bar', 'key' => 'value' ); $start = time(true); for ($i = 0; $i < 10000; $i++) { $a = isset($arr['foo']); $b = isset($arr['bar']); } var_dump(time(true) - $start); $start = time(true); for ($i = 0; $i < 10000; $i++) { $a = array_key_exists('foo', $arr); $b = array_key_exists('bar', $arr); } var_dump(time(true) - $start);
Output for 7.3.0 - 7.3.12, 7.4.0
Warning: time() expects exactly 0 parameters, 1 given in /in/7cfPR on line 8 Warning: time() expects exactly 0 parameters, 1 given in /in/7cfPR on line 13 int(0) Warning: time() expects exactly 0 parameters, 1 given in /in/7cfPR on line 15 Warning: time() expects exactly 0 parameters, 1 given in /in/7cfPR on line 20 int(0)
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.40, 5.4.42 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.20, 7.0.22 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.25
int(0) int(0)
Output for 5.4.41, 7.0.21
int(0) int(1)

preferences:
248.25 ms | 401 KiB | 322 Q