Answers for "php check if string end with"

PHP
0

php check if string ends with

function endsWith( $haystack, $needle ) {
    $length = strlen( $needle );
    if( !$length ) {
        return true;
    }
    return substr( $haystack, -$length ) === $needle;
}
Posted by: Guest on September-20-2021

Code answers related to "php check if string end with"

Browse Popular Code Answers by Language