The index() function takes string and search string as parameter. Here is the example code.
$string = "tester of the world";
$search_string = "r";
print index($string, $search_string);
This will output 5, as 5 is the first occurrence or search string from the provided string. You can use character, or string as search. And remember the index starts from 0. At above example r is at the 5th index.