In php:
stripos() function is used to find the position of the first occurrence of a case-insensitive substring in a string.
strripos() function is used to find the position of the last occurrence of a case-insensitive substring in a string.
Sample code:
$string = 'This is a string';
$substring ='i';
$firstIndex = stripos($string, $substring);
$lastIndex = strripos($string, $substring);
echo 'Fist index = ' . $firstIndex . ' ' . 'Last index = '. $lastIndex;
Output: Fist index = 2 Last index = 13