×

Welcome to TagMyCode

Please login or create account to add a snippet.
1
0
 
0
Language: PHP
Posted by: Massimo Zappino
Added: Jul 4, 2011 1:07 PM
Views: 124
Determines whether the beginning of a string matches a specified string.
  1. /**
  2.  * Determines whether the beginning of a string matches a specified string.
  3.  *
  4.  * @param string $baseString
  5.  * @param string $startString
  6.  * @return boolean
  7.  */
  8. public static function stringStartsWith($baseString, $startString)
  9. {
  10.     if (substr($baseString, 0, strlen($startString)) == $startString) {
  11.         return true;
  12.     }
  13.     return false;
  14. }