note 128608 added to function.str-ends-with
| From: | Reinder at main dot php dot net | Date: | Tue, 13 Jun 2023 10:30:56 +0000 |
| Subject: | note 128608 added to function.str-ends-with | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220566@lists.php.net to get a copy of this message | ||
In PHP7 you may want to use:
if (!function_exists('str_ends_with')) {
function str_ends_with($str, $end) {
return (@substr_compare($str, $end, -strlen($end))==0);
}
}
AFAIK that is binary safe and doesn't need additional checks.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.13.130 (proxied: 2605:6400:10:16e:e9da:a184:bfe1:e727)
----
Manual Page -- https://php.net/manual/en/function.str-ends-with.php
Edit -- https://main.php.net/note/edit/128608
Del: integrated -- https://main.php.net/note/delete/128608/integrated
Del: useless -- https://main.php.net/note/delete/128608/useless
Del: bad code -- https://main.php.net/note/delete/128608/bad+code
Del: spam -- https://main.php.net/note/delete/128608/spam
Del: non-english -- https://main.php.net/note/delete/128608/non-english
Del: in docs -- https://main.php.net/note/delete/128608/in+docs
Del: other reasons-- https://main.php.net/note/delete/128608
Reject -- https://main.php.net/note/reject/128608
Search -- https://main.php.net/manage/user-notes.php