What is the function in php to find a string which contains another string? I tried to find strcontain() function same as strlen(), but not available in php. Is there a method to find matching string or we need another methodology like regular expression to find it. I hope php should have some built in function to do this. Please post me sample ASAP.
you can use strops function to find a string in php.
example
$x = "Hi priya how are you";
Now you want to find the string priya from the above variable $x
then use something like below.
if (strpos($x,'priya') !== false) { echo 'true'; }
You could use an offset too:
<?php // We can search for the character, ignoring anything before the offset $newstring = 'abcdef abcdef'; $pos = strpos($newstring, 'a', 1); // $pos = 7, not 0 ?>