Dup Ver Goto 📝

StringPrefixTest

PT2/aw/lang/php php string prefix snippet does not exist
To
8 lines, 31 words, 222 chars Page 'StringPrefixTest' does not exist.
# is $needle a prefix of $haystack
function is_prefix(string $needle,string $haystack) : bool {
  $l = strlen($needle);
  if( $l > strlen($haystack) ) return false;
  return $needle === substr($haystack,0,$l);
}