strpos, strrpos, substr


$string = "search the position of the first, search the position of the last inside the string";
$search = "position";
$pos = strpos($string, $search);
echo $pos;
echo "<br>";
echo "<br>";

$pos2 = strrpos($string, $search);
echo $pos2;
echo "<br>";
echo "<br>";

$return = substr($string, $pos);
echo $return;

echo "<br>";
echo "<br>";
$return2 = substr($string, $pos2);
echo $return2;

echo "<br>";
echo "<br>";
//Find the position of the last occurrence of "php" inside the string:
echo strrpos("I love php, I love php too!","php");

echo "<br>";
echo "<br>";

//Find the position of the first occurrence of "php" inside the string:
echo strpos("I love php, I love php too!","php");