php - Preg match does not find the correct string -
I have a problem where I have a script that should search the XML file to match the string. This is my script:
& lt ;? Php $ file = "klein.xml"; $ Lines = file ($ file); Forex currency ($ lines $ line_name = & gt; $ as line) {echo htmlentities ($ line); Echo "& lt; br & gt;"; } If (preg_match ("/ message /", htmlentities ($ line), $ milli)) {echo "got!"; The echo found $ [0]; Resonant "examination"; } Else {echo "did not get it!"; }? & Gt; And this is the XML file that is working with:
& Lt; / Message header & gt; & Lt; / Product-data & gt; The problem is that when I work the prepay match 'product' correctly, but when I try to pre-pay with any other string it does 'work' ?
Im curious solution, thanks in advance!
Can you check this code, I noticed that if you have if Loop out foreach ; Therefore only the last line is executed. & lt ;? Php $ file = "klein.xml"; $ Lines = file ($ file); Foreign currency ($ rows $ line_num = & gt; $ line) {if (preg_match ("/ message /", htmlentities ($ line), $ mill)) {echo "got". $ Found [0] "& Lt; br / & gt;"; }}? & Gt;
Comments
Post a Comment