Adding str_ends_with(..)
This commit is contained in:
parent
e34f22a06b
commit
f5999339dd
|
@ -1163,3 +1163,11 @@ function arg_exists($args, $needle)
|
||||||
return in_array($needle, $args, $strict);
|
return in_array($needle, $args, $strict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!function_exists('str_ends_with'))
|
||||||
|
{
|
||||||
|
function str_ends_with($haystack, $needle)
|
||||||
|
{
|
||||||
|
// search forward starting from end minus needle length characters
|
||||||
|
return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue