Answers for "php get string between starts_with and ends_with"

PHP
1

startsWith() and endsWith() functions in PHP

function startsWith($haystack, $needle)
{
     $length = strlen($needle);
     return (substr($haystack, 0, $length) === $needle);
}

function endsWith($haystack, $needle)
{
    $length = strlen($needle);
    if ($length == 0) {
        return true;
    }

    return (substr($haystack, -$length) === $needle);
}
Posted by: Guest on May-18-2020

Code answers related to "php get string between starts_with and ends_with"

Browse Popular Code Answers by Language