Tag Archives: search

Find string in string

Like other people i’ve seen complaining about in the net, i keep forgetting how to do this. There are several ways of doing this, but here’s a simple one: $haystack = “Once upon a time, on a far away kingdom…”; $needle = “kingdom”; if(strstr($haystack,$needle)){ echo “Word found.”; }else{ echo “Couldn’t find the word.”; } Theā€¦ Read More »