PHP : Find String in a String

Its pretty easy to find out if a string exists in another string in PHP. There are predefined functions provided by PHP to do this job.

Using strpos - 

echo strpos("I love php, I love php too!","php");

Output: 7

 The strpos() function finds the position of the first occurrence of a string inside another string.

0 comments:

Post a Comment