3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
$empty 0.00 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.2.4, 5.2.6 - 5.2.9, 5.2.11 - 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.