3v4l.org

run code in 300+ PHP versions simultaneously
<?php printf("%s\n", PHP_VERSION); echo "\n"; $data = []; $i = 1000; $byteLength = 10000; while ($i--) { $data[] = base64_encode(random_bytes($byteLength)); } // PCRE $max = 100; $start = microtime(true); for ($c = 0; $c < $max; $c++) { for ($i = 0; $i < 1000; $i++) { $value = $data[$i]; false !== preg_match('~~u', $value); } } printf("Took %.7f seconds per execution\n", (microtime(true) - $start) / $max); echo "\n"; // mbstring $max = 100; $start = microtime(true); for ($c = 0; $c < $max; $c++) { for ($i = 0; $i < 1000; $i++) { $value = $data[$i]; false !== mb_check_encoding($value, 'UTF-8'); } } printf("Took %.7f seconds per execution\n", (microtime(true) - $start) / $max);

preferences:
23.39 ms | 410 KiB | 5 Q