I try to get all text to to the next occurrence of the comment tag and the text between the brackets from the comment tag. At the moment i only get the comment tag text between the brackets but not the content to the next comment its only returns a empty string "" I'm kind of confused. Thanks!
header("Content-Type:text/plain");
$tmp= file_get_contents("filter.html");
preg_match_all('@<!--\[(.*?)\]-->(.*?)@su', $tmp, $found, PREG_SET_ORDER);
var_dump($found);
filter.html
<!--[%TEST%]-->
TEST
TEST
<!--[%DAS%]-->
DAS TEST
123456
<!--[%BKK%]-->
ABCDEFG
YXZ
The output i get is:
array(3) {
[0]=>
array(3) {
[0]=>
string(15) "<!--[%TEST%]-->"
[1]=>
string(6) "%TEST%"
[2]=>
string(0) ""
}
[1]=>
array(3) {
[0]=>
string(14) "<!--[%DAS%]-->"
[1]=>
string(5) "%DAS%"
[2]=>
string(0) ""
}
[2]=>
array(3) {
[0]=>
string(14) "<!--[%BKK%]-->"
[1]=>
string(5) "%BKK%"
[2]=>
string(0) ""
}
}