note 126508 added to function.str-ends-with
| From: | etsavihail at gmail dot com | Date: | Thu, 14 Oct 2021 09:36:22 +0000 |
| Subject: | note 126508 added to function.str-ends-with | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217076@lists.php.net to get a copy of this message | ||
// 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;
}
}
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 2a01:6502:a4c:6f66:e1ec:d68f:b1be:f6c1)
----
Manual Page -- https://php.net/manual/en/function.str-ends-with.php
Edit -- https://main.php.net/note/edit/126508
Del: integrated -- https://main.php.net/note/delete/126508/integrated
Del: useless -- https://main.php.net/note/delete/126508/useless
Del: bad code -- https://main.php.net/note/delete/126508/bad+code
Del: spam -- https://main.php.net/note/delete/126508/spam
Del: non-english -- https://main.php.net/note/delete/126508/non-english
Del: in docs -- https://main.php.net/note/delete/126508/in+docs
Del: other reasons-- https://main.php.net/note/delete/126508
Reject -- https://main.php.net/note/reject/126508
Search -- https://main.php.net/manage/user-notes.php