note 126696 deleted from function.str-ends-with by cmb
| From: | cmb@php.net | Date: | Sun, 19 Dec 2021 21:36:16 +0000 |
| Subject: | note 126696 deleted from function.str-ends-with by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217391@lists.php.net to get a copy of this message | ||
Note Submitter: javad dot abdi at hotmail dot com
----
In PHP versions lower than 8 you can use this:
<?php
if (! function_exists('str_ends_with')) {
function str_ends_with($haystack, $needle) {
return stripos($haystack, $needle) === (strlen($haystack) - strlen($needle));
}
}
?>