I got a bunch of XML files that contain an ID. e.g.
<WINE_PRODUCER>9456</WINE_PRODUCER>
I need to check, e.g. which file contains a WINE_PRODUCER id=9456:
$content = file_get_contents("my.xml");
$Num = 9456;
$pattern = "<WINE_PRODUCER>$Num<\/WINE_PRODUCER>";
$res = preg_match("$pattern", $content);
I got error PHP Warning: preg_match(): Unknown modifier '9'
basically it does not like numbers in the pattern.
What do I do? googled a lot but all lead to matching a group of numbers...
PS: I do not want to use DOM xml parser in this case due to performance.
$res = strpos("<WINE_PRODUCER>$Num<\/WINE_PRODUCER>", $content);To test:if ($res !== false){ // found it }