How to search string in string php?

How to search string in string php?

Thanks Guys!

I have found the solution:

`$string = dfdfdjdkfjsdklfjdksfjekrjekjfdlkfjsdlfdflokuki48(fasza)kjdkfdjfkjkejrkerjer;


function get_string_between($string, $start, $end){
    $string =  .$string;
     $ini = strpos($string,$start);
     if ($ini == 0) return ;
     $ini += strlen($start);     
     $len = strpos($string,$end,$ini) - $ini;
     return substr($string,$ini,$len);
}

echo get_string_between($string,lokuki48(,));`

try this,

$string = dfdfdjdkfjsdklfjdksfjekrjekjfdlkfjsdlfdflokuki48(malac)kjdkfdjfkjkejrkerjer;
if (strpos($string, malac) !== false) 
{
    echo true;
}
else
{
    echo false;
}

https://3v4l.org/SiPvO

i hope it will be helpful.

How to search string in string php?

The strstr() function searches for the first occurrence of a string inside another string.

Example

Find the first occurrence of world inside Hello world! and return the rest of the string:

<?php
   echo strstr(Hello world!,world);
?>

Leave a Reply

Your email address will not be published. Required fields are marked *