3v4l.org

run code in 300+ PHP versions simultaneously
<?php $regex = ' (?<types> (?: (?:\{ (?&types) \}) | (a) ) (\*?) ) '; $captureOffsets = false; ini_set('pcre.jit', '0'); $res = preg_match('{^' . $regex . '$}x', '{a}', $matches, $captureOffsets ? PREG_OFFSET_CAPTURE : 0); ini_set('pcre.jit', '1'); // regex must be different to prevent regex cache, so just add 2nd "x" modifier $res2 = preg_match('{^' . $regex . '$}xx', '{a}', $matches2, $captureOffsets ? PREG_OFFSET_CAPTURE : 0); if ($matches !== $matches2) { echo 'without JIT:' . "\n"; print_r($matches); echo "\n"; echo 'with JIT:' . "\n"; print_r($matches2); } var_dump(PCRE_VERSION);

preferences:
34.63 ms | 407 KiB | 5 Q