<?PHP $str="The best time is no time at that time"; echo substr($str,0,3); //The echo substr($str,4,4); //best ?>
If no length is specified, the function returns the substring from the offset till the end of string.
<?PHP $str="The best time is no time at that time"; echo substr($str,3); //best time is no time at that time ?>
<?PHP $str="The best time is no time at that time"; echo substr($str,-3); //ime echo substr($str,4,-3); //best time is no time at that t ?>
Function
<?PHP $str = "<li><a href=\"http://www.endmemo.com/index.php\">EndMemo</a></li>" echo substr_count($str, "li"); //result is 2 ?>
<?PHP $str = "match Can Be Case Insensitive with i modifier"; echo preg_match_all("/se/",$str); //2 ?>