note 126508 deleted from function.str-ends-with by cmb
| From: | cmb@php.net | Date: | Thu, 14 Oct 2021 09:47:42 +0000 |
| Subject: | note 126508 deleted from function.str-ends-with by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217077@lists.php.net to get a copy of this message | ||
Note Submitter: etsavihail at gmail dot com
----
// Polyfill for PHP 4 - PHP 7, safe to utilize with PHP 8
if (!function_exists('str_ends_with')) {
function str_ends_with(string $haystack, string $needle) {
$length = strlen($needle);
return $length > 0 ? substr($haystack, -$length) === $needle : true;
}
}