What function can I use to find a particular string in a line?
e.g.
line1 -> "hello world, its me!"
The program would search for "its me!" for example. If it finds, it will echo that line...
you are looking for [man]strpos[/man] I presume
leatherback wrote:you are looking for [man]strpos[/man] I presume
strpos will look up for one string, right? What if I'll be looking for more than one string?
"hello world, its me!"
What if I must look for the "hello" and "its me!" string?
Call it twice or use regular expressions - see preg_match() and related. 🙂
In other words, something like:
$search = "hello|its me!"; $line = "hello world, its me!"; if(preg_match('/' . $search . '/', $line)) echo $line;