lang/php/ StringPrefixTest
# 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);
}
# 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);
}