php - Trying to only echo lines containing string -
I am trying to read a simple line-by-line of a file and resonates all the lines in which the user input The problem is that it shows every line that if any one matches, then am I sure that I am just making a mess of a reasonable brain, no one is sleeping, who is impotent for taking annoyance is?
File example -
Bob class 1 class 1 den class 2 Example 1 (correct) < / P>
Input: horse output: nothing (true) Example 2 (wrong)
Input: class 1 Output: Bob Class 1, Class 1 Dan Class 2 (Everything!)
You Preg_match () foreach Function inside the loop: foreach ($ height as $ alegre) {if (preg_match ("/ $ klassekode / i", $ Height) === 1) {echo $ elev; }}
Comments
Post a Comment