Professional Documents
Culture Documents
2
2
The text is “He opened the file and saw that there were only thirty visible light images and
twelve radar images of Deimos”
When we replace “images” with “problems” the text becomes “He opened the file and saw
that there were only thirty visible light problems and twelve radar problems of Deimos”
The uppercase version of the is: “HE OPENED THE FILE AND SAW THAT THERE WERE ONLY
THIRTY VISIBLE LIGHT IMAGES AND TWELVE RADAR IMAGES OF DEIMOS”
<?php
$txt= "“He opened the file and saw that there were only thirty visible light images and twelve radar images of Deimos”";
$str= "images";
$rplc= "problems";
$numofchars=10;
$occr="f";
echo "The text is ".$txt;
echo "<br><br>The text includes “".preg_match_all('/[aeiou]/i',$txt,$matches)."” vowels.";
echo "<br><br>The text is formed from “".strlen($txt)."” words.";
echo "<br><br>When we replace “".$str."” with “".$rplc."” the text becomes ".str_replace($str,$rplc,$txt);
echo "<br><br>The first “".$numofchars."” characters of the string are: “".substr($txt,$numofchars);
echo "<br><br>The last “".$numofchars."” characters of the string are: “".substr($txt,-2*$numofchars);
echo "<br><br>The first occurance of “".$occr."” is “".substr_count($txt, $occr)."”. character.";
echo "<br><br>The uppercase version of the is: “".strtoupper($txt);
?>