<?php
/* working with strings */
$string = "Albuquerque is the largest city in the state of New Mexico.";
echo "<div style='font-size:22px;color:#337722;'>";
/* finding characters */
$c = strpos($string, "c");
echo "The first letter 'c' was found at position #$c.<br>";
$c2 = strpos($string, "c", $c + 1);
echo "The second letter 'c' was found at position #$c2.<br>";
/* replacing parts of a string */
$new = str_replace("ue", "UE", $string);
echo "$new<br>";
/* substring replacements */
$new2 = substr_replace($string, "", 0, 10);
$new3 = substr_replace($string, "", -10, 10);
echo "$new2<br>";
echo "$new3<br>";
/* string to array */
$parts = explode(" ", $string);
echo "The 5th word is <b>$parts[4]</b>.<br>";
/* array to string */
$new4 = implode("_", $parts);
echo "$new4<br>";
echo "</div>";
?>