3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function startsWith($haystack, $needle) { return $needle === "" || strpos($haystack, $needle) === 0; } $haystack = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; $a = null; $b = null; $c = null; $t = microtime(true); for($i = 0; $i < 1000000; $i++) { $a = startsWith($haystack, '789'); $b = startsWith($haystack, 'aaa'); $c = startsWith($haystack, 'abc'); } echo sprintf("took %.6f second(s)", microtime(true) - $t);
Output for 7.1.0
took 0.249218 second(s)
Output for 7.0.14
took 0.303751 second(s)
Output for 7.0.6
took 0.209134 second(s)
Output for 7.0.5
took 0.196095 second(s)
Output for 7.0.4
took 0.199461 second(s)
Output for 7.0.3
took 0.218802 second(s)
Output for 7.0.2
took 0.206652 second(s)
Output for 7.0.1
took 0.277458 second(s)
Output for 7.0.0
took 0.200951 second(s)
Output for hhvm-3.12.0
took 0.666189 second(s)
Output for hhvm-3.10.0
took 0.851125 second(s)
Output for 5.6.28
took 0.457696 second(s)
Output for 5.6.21
took 0.784345 second(s)
Output for 5.6.20
took 0.790545 second(s)
Output for 5.6.19
took 0.728903 second(s)
Output for 5.6.18
took 0.737627 second(s)
Output for 5.6.17
took 0.716046 second(s)
Output for 5.6.16
took 0.706037 second(s)
Output for 5.6.15
took 0.701708 second(s)
Output for 5.6.14
took 0.724327 second(s)
Output for 5.6.13
took 0.728695 second(s)
Output for 5.6.12
took 0.827624 second(s)
Output for 5.6.11
took 0.730111 second(s)
Output for 5.6.10
took 0.718070 second(s)
Output for 5.6.9
took 0.731468 second(s)
Output for 5.6.8
took 0.710723 second(s)
Output for 5.5.35
took 0.754883 second(s)
Output for 5.5.34
took 0.778496 second(s)
Output for 5.5.33
took 0.713403 second(s)
Output for 5.5.32
took 0.703852 second(s)
Output for 5.5.31
took 0.733427 second(s)
Output for 5.5.30
took 0.747032 second(s)
Output for 5.5.29
took 0.712080 second(s)
Output for 5.5.28
took 0.787193 second(s)
Output for 5.5.27
took 0.749761 second(s)
Output for 5.5.26
took 0.742489 second(s)
Output for 5.5.25
took 0.818752 second(s)
Output for 5.5.24
took 0.716792 second(s)
Output for 5.4.45
took 0.848071 second(s)
Output for 5.4.44
took 0.726401 second(s)
Output for 5.4.43
took 1.150490 second(s)
Output for 5.4.42
took 1.295181 second(s)
Output for 5.4.41
took 1.121659 second(s)
Output for 5.4.40
took 1.117396 second(s)
Output for 5.4.39
took 1.110913 second(s)
Output for 5.4.38
took 1.070844 second(s)
Output for 5.4.37
took 1.096872 second(s)
Output for 5.4.36
took 1.179453 second(s)
Output for 5.4.35
took 1.283061 second(s)
Output for 5.4.34
took 1.153397 second(s)
Output for 5.4.32
took 1.193447 second(s)
Output for 5.4.31
took 1.110444 second(s)
Output for 5.4.30
took 1.172304 second(s)
Output for 5.4.29
took 1.133331 second(s)
Output for 5.4.28
took 1.128029 second(s)
Output for 5.4.27
took 1.220618 second(s)
Output for 5.4.26
took 1.168676 second(s)
Output for 5.4.25
took 1.102130 second(s)
Output for 5.4.24
took 1.210311 second(s)
Output for 5.4.23
took 1.134673 second(s)
Output for 5.4.22
took 1.145471 second(s)
Output for 5.4.21
took 1.068154 second(s)
Output for 5.4.20
took 1.127452 second(s)
Output for 5.4.19
took 1.191813 second(s)
Output for 5.4.18
took 1.223002 second(s)
Output for 5.4.17
took 1.139125 second(s)
Output for 5.4.16
took 1.113360 second(s)
Output for 5.4.15
took 1.092337 second(s)
Output for 5.4.14
took 1.091006 second(s)
Output for 5.4.13
took 1.281984 second(s)
Output for 5.4.12
took 1.183142 second(s)
Output for 5.4.11
took 1.113373 second(s)
Output for 5.4.10
took 1.089642 second(s)
Output for 5.4.9
took 1.084050 second(s)
Output for 5.4.8
took 1.150509 second(s)
Output for 5.4.7
took 1.113970 second(s)
Output for 5.4.6
took 1.153327 second(s)
Output for 5.4.5
took 1.100136 second(s)
Output for 5.4.4
took 1.142819 second(s)
Output for 5.4.3
took 1.099718 second(s)
Output for 5.4.2
took 1.218712 second(s)
Output for 5.4.1
took 1.091792 second(s)
Output for 5.4.0
took 1.083382 second(s)
Output for 5.3.29
took 1.388435 second(s)
Output for 5.3.28
took 1.472834 second(s)
Output for 5.3.27
took 1.558575 second(s)
Output for 5.3.26
took 1.507944 second(s)
Output for 5.3.25
took 1.456280 second(s)
Output for 5.3.24
took 1.414453 second(s)
Output for 5.3.23
took 1.498177 second(s)
Output for 5.3.22
took 1.752286 second(s)
Output for 5.3.21
took 1.596380 second(s)
Output for 5.3.20
took 1.659227 second(s)
Output for 5.3.19
took 1.525302 second(s)
Output for 5.3.18
took 1.488332 second(s)
Output for 5.3.17
took 1.422040 second(s)
Output for 5.3.16
took 1.703645 second(s)
Output for 5.3.15
took 1.457186 second(s)
Output for 5.3.14
took 1.492572 second(s)
Output for 5.3.13
took 1.484257 second(s)
Output for 5.3.12
took 1.509924 second(s)
Output for 5.3.11
took 1.510656 second(s)
Output for 5.3.10
took 1.482871 second(s)
Output for 5.3.9
took 1.605941 second(s)
Output for 5.3.8
took 1.412132 second(s)
Output for 5.3.7
took 1.499672 second(s)
Output for 5.3.6
took 1.581463 second(s)
Output for 5.3.5
took 1.429679 second(s)
Output for 5.3.4
took 1.458296 second(s)
Output for 5.2.17
took 1.820200 second(s)
Output for 5.2.16
took 1.829340 second(s)
Output for 5.2.15
took 1.781186 second(s)