<?php
// example code
ini_set('pcre.backtrack_limit', 1);
$text = "<p>www.test.com</p>";
$chunks = is_null($text) ? array('') : preg_split('/(<.+?>)/is', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
var_dump($chunks);
- Output for 7.3.33, 8.1.0 - 8.1.30, 8.2.10 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1
- bool(false)
- Output for 7.0.33, 7.1.33, 7.2.34
- array(3) {
[0]=>
string(0) ""
[1]=>
string(3) "<p>"
[2]=>
string(16) "www.test.com</p>"
}
- Output for 5.3.29, 5.6.40
- array(1) {
[0]=>
string(19) "<p>www.test.com</p>"
}
preferences:
38.17 ms | 408 KiB | 5 Q