How to find the position of the last occurrence of a case-insensitive substring in a string with PHP

2 Answers

0 votes
// int strripos(string $haystack , string $needle [, int $offset = 0 ])

$haystack = 'abcdabcd';
$needle   = 'Bc';

echo strripos($haystack, $needle);



/*
run:
    
5 
    
*/

 



answered Jul 20, 2016 by avibootz
0 votes
// int strripos(string $haystack , string $needle [, int $offset = 0 ])

$haystack = 'abcdabcd';
$needle   = 'Bc';

$pos = strripos($haystack, $needle);

if ($pos === false) 
    echo "Not Found";
else 
    echo "Found";




/*
run:
    
Found  
    
*/

 



answered Jul 20, 2016 by avibootz
...