3v4l.org

run code in 300+ PHP versions simultaneously
<?php/** * Compare building an array an in_array()ing it, vs a regex check */$runs = 1000000;// in_array$t = microtime(true);for ($i = 0; $i < $runs; $i++) { if (in_array('test', ['foo','bar','baz','fooby','bario','xyz','abc','def','ghi','jkl','mno','pqr','stu','vwx']));}$t -= microtime(true);echo 'in_array: ', $t, PHP_EOL;// preg_match$t = microtime(true);for ($i = 0; $i < $runs; $i++) { if (preg_match('/^(foo|bar|baz|fooby|bario|xyz|abc|def|ghi|jkl|mno|pqr|stu|vwx)$/', 'test'));}$t -= microtime(true);echo 'preg_match: ', $t, PHP_EOL;<?php

This is an error 404

There are `0` results


preferences:
143.37 ms | 1399 KiB | 7 Q