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"; }
Output for 7.4.5
strtolower is 6.19x faster than mb_strtolower for empty strtolower is 2.89x faster than mb_strtolower for short strtolower is 7.09x faster than mb_strtolower for short_with_uc strtolower is 17.57x faster than mb_strtolower for long strtolower is 16.79x faster than mb_strtolower for long_with_uc strtolower is 8.58x faster than mb_strtolower for short_utf8 strtolower is 9.1x faster than mb_strtolower for short_utf8_with_uc
Output for 7.4.4
strtolower is 4.48x faster than mb_strtolower for empty strtolower is 8x faster than mb_strtolower for short strtolower is 6.84x faster than mb_strtolower for short_with_uc strtolower is 24.15x faster than mb_strtolower for long strtolower is 21.12x faster than mb_strtolower for long_with_uc strtolower is 11.11x faster than mb_strtolower for short_utf8 strtolower is 10.32x faster than mb_strtolower for short_utf8_with_uc
Output for 7.4.3
strtolower is 6.78x faster than mb_strtolower for empty strtolower is 8.17x faster than mb_strtolower for short strtolower is 4.58x faster than mb_strtolower for short_with_uc strtolower is 25.74x faster than mb_strtolower for long strtolower is 23.41x faster than mb_strtolower for long_with_uc strtolower is 9.89x faster than mb_strtolower for short_utf8 strtolower is 10.14x faster than mb_strtolower for short_utf8_with_uc
Output for 7.4.2
strtolower is 5.18x faster than mb_strtolower for empty strtolower is 9.51x faster than mb_strtolower for short strtolower is 6.73x faster than mb_strtolower for short_with_uc strtolower is 18.1x faster than mb_strtolower for long strtolower is 20.12x faster than mb_strtolower for long_with_uc strtolower is 11.58x faster than mb_strtolower for short_utf8 strtolower is 11.41x faster than mb_strtolower for short_utf8_with_uc
Output for 7.4.1
strtolower is 6.58x faster than mb_strtolower for empty strtolower is 9.57x faster than mb_strtolower for short strtolower is 7.45x faster than mb_strtolower for short_with_uc strtolower is 23.26x faster than mb_strtolower for long strtolower is 17.72x faster than mb_strtolower for long_with_uc strtolower is 6.75x faster than mb_strtolower for short_utf8 strtolower is 6.69x faster than mb_strtolower for short_utf8_with_uc
Output for 7.4.0
strtolower is 7.01x faster than mb_strtolower for empty strtolower is 10.33x faster than mb_strtolower for short strtolower is 3.3x faster than mb_strtolower for short_with_uc strtolower is 19.85x faster than mb_strtolower for long strtolower is 13.52x faster than mb_strtolower for long_with_uc strtolower is 6.69x faster than mb_strtolower for short_utf8 strtolower is 8.1x faster than mb_strtolower for short_utf8_with_uc
Output for 7.3.17
strtolower is 5.1x faster than mb_strtolower for empty strtolower is 7.83x faster than mb_strtolower for short strtolower is 6.17x faster than mb_strtolower for short_with_uc strtolower is 25.29x faster than mb_strtolower for long strtolower is 24.09x faster than mb_strtolower for long_with_uc strtolower is 8.27x faster than mb_strtolower for short_utf8 strtolower is 8.78x faster than mb_strtolower for short_utf8_with_uc
Output for 7.3.16
strtolower is 5.48x faster than mb_strtolower for empty strtolower is 8.89x faster than mb_strtolower for short strtolower is 6.35x faster than mb_strtolower for short_with_uc strtolower is 22.42x faster than mb_strtolower for long strtolower is 19.3x faster than mb_strtolower for long_with_uc strtolower is 13.14x faster than mb_strtolower for short_utf8 strtolower is 10.09x faster than mb_strtolower for short_utf8_with_uc
Output for 7.3.15
strtolower is 6.66x faster than mb_strtolower for empty strtolower is 10.22x faster than mb_strtolower for short strtolower is 6.26x faster than mb_strtolower for short_with_uc strtolower is 18.39x faster than mb_strtolower for long strtolower is 22.68x faster than mb_strtolower for long_with_uc strtolower is 13.37x faster than mb_strtolower for short_utf8 strtolower is 11.04x faster than mb_strtolower for short_utf8_with_uc
Output for 7.3.14
strtolower is 4.95x faster than mb_strtolower for empty strtolower is 6.78x faster than mb_strtolower for short strtolower is 5.89x faster than mb_strtolower for short_with_uc strtolower is 22.44x faster than mb_strtolower for long strtolower is 22.42x faster than mb_strtolower for long_with_uc strtolower is 7.74x faster than mb_strtolower for short_utf8 strtolower is 6.26x faster than mb_strtolower for short_utf8_with_uc
Output for 7.3.13
strtolower is 5.15x faster than mb_strtolower for empty strtolower is 12.11x faster than mb_strtolower for short strtolower is 0.94x faster than mb_strtolower for short_with_uc strtolower is 22.72x faster than mb_strtolower for long strtolower is 20.77x faster than mb_strtolower for long_with_uc strtolower is 6.28x faster than mb_strtolower for short_utf8 strtolower is 6.5x faster than mb_strtolower for short_utf8_with_uc
Output for 7.3.12
strtolower is 7.12x faster than mb_strtolower for empty strtolower is 7.17x faster than mb_strtolower for short strtolower is 5.03x faster than mb_strtolower for short_with_uc strtolower is 17.16x faster than mb_strtolower for long strtolower is 27.95x faster than mb_strtolower for long_with_uc strtolower is 10.7x faster than mb_strtolower for short_utf8 strtolower is 7.69x faster than mb_strtolower for short_utf8_with_uc
Output for 7.3.11
strtolower is 7.89x faster than mb_strtolower for empty strtolower is 8.74x faster than mb_strtolower for short strtolower is 7.37x faster than mb_strtolower for short_with_uc strtolower is 23.78x faster than mb_strtolower for long strtolower is 20.04x faster than mb_strtolower for long_with_uc strtolower is 8.58x faster than mb_strtolower for short_utf8 strtolower is 8.68x faster than mb_strtolower for short_utf8_with_uc
Output for 7.3.10
strtolower is 6.36x faster than mb_strtolower for empty strtolower is 8.6x faster than mb_strtolower for short strtolower is 3.27x faster than mb_strtolower for short_with_uc strtolower is 23.84x faster than mb_strtolower for long strtolower is 22.64x faster than mb_strtolower for long_with_uc strtolower is 8.75x faster than mb_strtolower for short_utf8 strtolower is 9.77x faster than mb_strtolower for short_utf8_with_uc
Output for 7.3.9
strtolower is 6.97x faster than mb_strtolower for empty strtolower is 7.81x faster than mb_strtolower for short strtolower is 3.78x faster than mb_strtolower for short_with_uc strtolower is 23.45x faster than mb_strtolower for long strtolower is 22.83x faster than mb_strtolower for long_with_uc strtolower is 8x faster than mb_strtolower for short_utf8 strtolower is 9.66x faster than mb_strtolower for short_utf8_with_uc
Output for 7.3.8
strtolower is 4.48x faster than mb_strtolower for empty strtolower is 11.25x faster than mb_strtolower for short strtolower is 6.86x faster than mb_strtolower for short_with_uc strtolower is 23.82x faster than mb_strtolower for long strtolower is 21.58x faster than mb_strtolower for long_with_uc strtolower is 9.02x faster than mb_strtolower for short_utf8 strtolower is 9.78x faster than mb_strtolower for short_utf8_with_uc
Output for 7.3.7
strtolower is 7.86x faster than mb_strtolower for empty strtolower is 9.46x faster than mb_strtolower for short strtolower is 3.85x faster than mb_strtolower for short_with_uc strtolower is 20.45x faster than mb_strtolower for long strtolower is 23.7x faster than mb_strtolower for long_with_uc strtolower is 9.84x faster than mb_strtolower for short_utf8 strtolower is 5.6x faster than mb_strtolower for short_utf8_with_uc
Output for 7.2.29
strtolower is 97.39x faster than mb_strtolower for empty strtolower is 80.28x faster than mb_strtolower for short strtolower is 68.9x faster than mb_strtolower for short_with_uc strtolower is 111.01x faster than mb_strtolower for long
Process exited with code 137.
Output for 7.2.28
strtolower is 63.33x faster than mb_strtolower for empty strtolower is 79.04x faster than mb_strtolower for short strtolower is 46.46x faster than mb_strtolower for short_with_uc strtolower is 145.73x faster than mb_strtolower for long
Process exited with code 137.
Output for 7.2.27
strtolower is 99.89x faster than mb_strtolower for empty strtolower is 122.57x faster than mb_strtolower for short strtolower is 117.77x faster than mb_strtolower for short_with_uc strtolower is 154.72x faster than mb_strtolower for long
Process exited with code 137.
Output for 7.2.26
strtolower is 46.3x faster than mb_strtolower for empty strtolower is 14.97x faster than mb_strtolower for short strtolower is 48.91x faster than mb_strtolower for short_with_uc strtolower is 99.21x faster than mb_strtolower for long
Process exited with code 137.
Output for 7.2.25
strtolower is 92.01x faster than mb_strtolower for empty strtolower is 35.24x faster than mb_strtolower for short strtolower is 55.12x faster than mb_strtolower for short_with_uc strtolower is 83.01x faster than mb_strtolower for long strtolower is 117.34x faster than mb_strtolower for long_with_uc strtolower is 72.26x faster than mb_strtolower for short_utf8 strtolower is 71.43x faster than mb_strtolower for short_utf8_with_uc
Output for 7.2.24
strtolower is 84.89x faster than mb_strtolower for empty strtolower is 85.47x faster than mb_strtolower for short strtolower is 50.06x faster than mb_strtolower for short_with_uc strtolower is 90.79x faster than mb_strtolower for long strtolower is 80.21x faster than mb_strtolower for long_with_uc strtolower is 50.27x faster than mb_strtolower for short_utf8 strtolower is 80.01x faster than mb_strtolower for short_utf8_with_uc
Output for 7.2.23
strtolower is 90.15x faster than mb_strtolower for empty strtolower is 109.38x faster than mb_strtolower for short strtolower is 29.16x faster than mb_strtolower for short_with_uc strtolower is 124.28x faster than mb_strtolower for long strtolower is 143.48x faster than mb_strtolower for long_with_uc strtolower is 74.66x faster than mb_strtolower for short_utf8 strtolower is 81.98x faster than mb_strtolower for short_utf8_with_uc
Output for 7.2.22
strtolower is 104.42x faster than mb_strtolower for empty strtolower is 74.86x faster than mb_strtolower for short strtolower is 68.74x faster than mb_strtolower for short_with_uc strtolower is 143.84x faster than mb_strtolower for long
Process exited with code 137.
Output for 7.2.21
strtolower is 62.98x faster than mb_strtolower for empty strtolower is 79x faster than mb_strtolower for short strtolower is 60.83x faster than mb_strtolower for short_with_uc strtolower is 162.81x faster than mb_strtolower for long
Process exited with code 137.
Output for 7.2.20
strtolower is 85.79x faster than mb_strtolower for empty strtolower is 93.08x faster than mb_strtolower for short strtolower is 43.59x faster than mb_strtolower for short_with_uc strtolower is 163.38x faster than mb_strtolower for long
Process exited with code 137.

preferences:
66.33 ms | 401 KiB | 32 Q