note 126532 added to function.str-ends-with
| From: | Reinder at main dot php dot net | Date: | Sat, 23 Oct 2021 11:10:32 +0000 |
| Subject: | note 126532 added to function.str-ends-with | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217105@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: 45.112.85.242 (proxied: 2001:1c02:160c:600:2d7b:83b2:c891:de8)
----
Manual Page -- https://php.net/manual/en/function.str-ends-with.php
Edit -- https://main.php.net/note/edit/126532
Del: integrated -- https://main.php.net/note/delete/126532/integrated
Del: useless -- https://main.php.net/note/delete/126532/useless
Del: bad code -- https://main.php.net/note/delete/126532/bad+code
Del: spam -- https://main.php.net/note/delete/126532/spam
Del: non-english -- https://main.php.net/note/delete/126532/non-english
Del: in docs -- https://main.php.net/note/delete/126532/in+docs
Del: other reasons-- https://main.php.net/note/delete/126532
Reject -- https://main.php.net/note/reject/126532
Search -- https://main.php.net/manage/user-notes.php