Here's example code showing how to find the position of a character in a string:
<?
$source_string="maze";
$character_to_find="z";
$position=strpos($source_string,$character_to_find);
if ( $position===false )
{
echo "Can't find it!";
}
else
{
echo $position;
}
?>
You can also use strstr to find an entire string within a string. To search backwards, use strrev to reverse a string, then use strpos or strstr to do the search.