- var_dump: documentation ( source)
- preg_match: documentation ( source)
- print_r: documentation ( source)
- ini_set: documentation ( source)
<?php
$regex = '
(?<types>
(?:
(?:\{ (?&types) \})
| (a)
)
(\*?)
)
';
ini_set('pcre.jit', '0');
$res = preg_match('{^' . $regex . '$}x', '{a}', $matches);
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);
var_dump($matches === $matches2);
echo 'without JIT:' . "\n";
print_r($matches);
echo "\n";
echo 'with JIT:' . "\n";
print_r($matches2);