Search

Check if strings ends with a specified string PHP

> String endsWith() method

Description
Check if strings ends with a specified string


function endsWith( $haystack, $needle ) {
    return $needle === "" || (substr($haystack, -strlen($needle)) === $needle);
}
SEE ALSO