Automattic\WooCommerce\Vendor\Symfony\Polyfill\Php80

Php80::str_ends_withpublic staticWC 1.0

Method of the class: Php80{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = Php80::str_ends_with( $haystack, $needle ): bool;
$haystack(string) (required)
.
$needle(string) (required)
.

Php80::str_ends_with() code WC 10.4.3

public static function str_ends_with(string $haystack, string $needle): bool
{
    if ('' === $needle || $needle === $haystack) {
        return true;
    }

    if ('' === $haystack) {
        return false;
    }

    $needleLength = \strlen($needle);

    return $needleLength <= \strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength);
}