3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = '<p>www.test.com</p>'; echo 'pcre.backtrack_limit: ' . ini_get('pcre.backtrack_limit') . PHP_EOL; $chunks = preg_split('/(<.+?>)/is', $text, -1, PREG_SPLIT_DELIM_CAPTURE); echo 'error: ' . preg_last_error() . PHP_EOL; is_array($chunks) ? print_r($chunks) : var_dump($chunks); ini_set('pcre.backtrack_limit', 1); echo 'pcre.backtrack_limit: ' . ini_get('pcre.backtrack_limit') . PHP_EOL; $chunks = preg_split('/(<.+?>)/is', $text, -1, PREG_SPLIT_DELIM_CAPTURE); echo 'error: ' . preg_last_error() . PHP_EOL; is_array($chunks) ? print_r($chunks) : var_dump($chunks);
Output for 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
pcre.backtrack_limit: 1000000 error: 0 Array ( [0] => [1] => <p> [2] => www.test.com [3] => </p> [4] => ) pcre.backtrack_limit: 1 error: 2 bool(false)
Output for 7.2.34
pcre.backtrack_limit: 1000000 error: 0 Array ( [0] => [1] => <p> [2] => www.test.com [3] => </p> [4] => ) pcre.backtrack_limit: 1 error: 2 Array ( [0] => [1] => <p> [2] => www.test.com</p> )
Output for 5.3.29, 5.6.40
pcre.backtrack_limit: 1000000 error: 0 Array ( [0] => [1] => <p> [2] => www.test.com [3] => </p> [4] => ) pcre.backtrack_limit: 1 error: 2 Array ( [0] => <p>www.test.com</p> )

preferences:
80.64 ms | 408 KiB | 5 Q