3v4l.org

run code in 300+ PHP versions simultaneously
<?php $cnt = 1000; $strs = [ 'empty' => '', 'short' => 'zluty kun', 'short_with_uc' => 'zluty Kun', 'long' => str_repeat('this is about 10000 chars long string', 270), 'long_with_uc' => str_repeat('this is about 10000 chars long String', 270), 'short_utf8' => 'žlutý kůň', 'short_utf8_with_uc' => 'Žlutý kŮň', ]; foreach ($strs as $k => $str) { $a1 = microtime(true); for($i=0; $i < $cnt; ++$i){ $res = strtolower($str); } $t1 = microtime(true) - $a1; // echo 'it took ' . round($t1 * 1000, 3) . ' ms for ++$i'."\n"; $a2 = microtime(true); for($i=0; $i < $cnt; $i++){ $res = mb_strtolower($str); } $t2 = microtime(true) - $a2; // echo 'it took ' . round($t2 * 1000, 3) . ' ms for $i++'."\n"; echo 'strtolower is '.round($t2/$t1, 2).'x faster than mb_strtolower for ' . $k . "\n\n"; }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.4.50.0130.49316.57
7.4.40.0100.46816.73
7.4.30.0260.47616.51
7.4.20.0290.42016.53
7.4.10.0100.46816.68
7.4.00.0100.47116.67
7.3.170.0190.45416.58
7.3.160.0260.54516.71
7.3.150.0130.49116.58
7.3.140.0130.43816.42
7.3.130.0030.46416.78
7.3.120.0030.50816.53
7.3.110.0100.41116.62
7.3.100.0060.41016.74
7.3.90.0100.42916.56
7.3.80.0130.45616.80
7.3.70.0130.42416.41
7.2.290.0252.21516.80
7.2.280.0322.25016.85
7.2.270.0252.34216.80
7.2.260.0232.40716.77
7.2.250.0072.26216.66
7.2.240.0232.31216.90
7.2.230.0092.26316.90
7.2.220.0162.44916.82
7.2.210.0102.46116.83
7.2.200.0422.42216.58

preferences:
37.53 ms | 401 KiB | 5 Q