3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = array( '$empty' => array(), '$full' => range(1, 1000), ); $count = 100 * 1000; foreach ($tests as $name => $array) { printf("%-10s", $name); $start = microtime(true); $i = $count; while ($i-- > 0) { (bool) $array; } $total = microtime(true) - $start; printf("%.2F sec total, %.4F sec/iter\n", $total, $total / $count); }
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.2.0 - 7.2.4, 7.2.6 - 7.2.8, 7.2.13, 7.3.0 - 7.3.1
$empty 0.00 sec total, 0.0000 sec/iter $full 0.00 sec total, 0.0000 sec/iter
Output for 7.2.12
$empty 0.04 sec total, 0.0000 sec/iter $full 0.00 sec total, 0.0000 sec/iter
Output for 7.2.11
$empty 0.12 sec total, 0.0000 sec/iter $full 0.00 sec total, 0.0000 sec/iter
Output for 7.2.10
$empty 0.03 sec total, 0.0000 sec/iter $full 0.00 sec total, 0.0000 sec/iter
Output for 7.2.9
$empty 0.06 sec total, 0.0000 sec/iter $full 0.00 sec total, 0.0000 sec/iter
Output for 7.1.25, 7.2.5
$empty 0.01 sec total, 0.0000 sec/iter $full 0.00 sec total, 0.0000 sec/iter
Output for 5.6.28
$empty 0.01 sec total, 0.0000 sec/iter $full 2.15 sec total, 0.0000 sec/iter
Output for 5.5.29 - 5.5.30, 5.6.21
$empty 0.01 sec total, 0.0000 sec/iter $full 2.30 sec total, 0.0000 sec/iter
Output for 5.6.14, 5.6.20
$empty 0.01 sec total, 0.0000 sec/iter $full 2.22 sec total, 0.0000 sec/iter
Output for 5.5.26, 5.6.19
$empty 0.01 sec total, 0.0000 sec/iter $full 2.25 sec total, 0.0000 sec/iter
Output for 5.6.18
$empty 0.00 sec total, 0.0000 sec/iter $full
Process exited with code 137.
Output for 5.5.28, 5.6.10, 5.6.12, 5.6.17
$empty 0.01 sec total, 0.0000 sec/iter $full 2.20 sec total, 0.0000 sec/iter
Output for 5.6.16
$empty 0.01 sec total, 0.0000 sec/iter $full 2.24 sec total, 0.0000 sec/iter
Output for 5.6.13, 5.6.15
$empty 0.00 sec total, 0.0000 sec/iter $full 2.24 sec total, 0.0000 sec/iter
Output for 5.1.0 - 5.1.3, 5.1.5 - 5.1.6, 5.2.0 - 5.2.4, 5.2.6 - 5.2.9, 5.2.11 - 5.2.17, 5.3.0 - 5.3.4, 5.3.6 - 5.3.8, 5.3.10 - 5.3.12, 5.3.14 - 5.3.15, 5.3.17, 5.3.19 - 5.3.21, 5.3.23 - 5.3.28, 5.4.0 - 5.4.23, 5.4.26 - 5.4.45, 5.6.11
$empty 0.01 sec total, 0.0000 sec/iter $full
Process exited with code 137.
Output for 5.6.9
$empty 0.00 sec total, 0.0000 sec/iter $full 2.12 sec total, 0.0000 sec/iter
Output for 5.5.27, 5.6.8
$empty 0.01 sec total, 0.0000 sec/iter $full 2.28 sec total, 0.0000 sec/iter
Output for 5.6.7
$empty 0.01 sec total, 0.0000 sec/iter $full 2.01 sec total, 0.0000 sec/iter
Output for 5.5.35
$empty 0.01 sec total, 0.0000 sec/iter $full 2.11 sec total, 0.0000 sec/iter
Output for 5.5.34
$empty 0.01 sec total, 0.0000 sec/iter $full 2.23 sec total, 0.0000 sec/iter
Output for 5.5.33
$empty 0.01 sec total, 0.0000 sec/iter $full 2.33 sec total, 0.0000 sec/iter
Output for 5.5.32
$empty 0.01 sec total, 0.0000 sec/iter $full 2.35 sec total, 0.0000 sec/iter
Output for 5.5.31
$empty 0.01 sec total, 0.0000 sec/iter $full 2.16 sec total, 0.0000 sec/iter
Output for 5.5.25
$empty 0.01 sec total, 0.0000 sec/iter $full 2.29 sec total, 0.0000 sec/iter
Output for 5.5.24
$empty 0.01 sec total, 0.0000 sec/iter $full 2.36 sec total, 0.0000 sec/iter
Output for 4.3.10, 4.4.0, 4.4.3 - 4.4.4, 4.4.6, 4.4.8 - 4.4.9, 5.0.4 - 5.0.5, 5.1.4, 5.2.5, 5.2.10, 5.3.5, 5.3.9, 5.3.13, 5.3.16, 5.3.18, 5.3.22, 5.3.29, 5.4.24 - 5.4.25
$empty 0.02 sec total, 0.0000 sec/iter $full
Process exited with code 137.
Output for 4.3.11, 4.4.7, 5.0.3
$empty 0.04 sec total, 0.0000 sec/iter $full
Process exited with code 137.
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.2
$empty sec total, sec/iter $full
Process exited with code 137.
Output for 4.4.2, 4.4.5
$empty 0.05 sec total, 0.0000 sec/iter $full
Process exited with code 137.
Output for 4.4.1
$empty 0.03 sec total, 0.0000 sec/iter $full
Process exited with code 137.

preferences:
146.62 ms | 401 KiB | 191 Q