Miscellany
public text v1 · immutable<?php
$string1 = "he said hello world";
$string2 = "hello molly he said";
function myReplace($string){
$myString = strstr($string, "hello");
if (strlen($myString)> 11)
{
$myString = substr($myString, 0, 11);
echo "<p>" .$myString. "</p>";
}else {
echo "<p>" .$myString. "</p>";
}
}
myReplace($string1);
myReplace($string2);
?>