note 126172 added to function.str-ends-with

From: Date: Mon, 14 Jun 2021 23:39:51 +0000
Subject: note 126172 added to function.str-ends-with
Groups: php.notes 
Request: Send a blank email to php-notes+get-216524@lists.php.net to get a copy of this message
if (!function_exists( 'str_ends_with')) { function str_ends_with ($haystack, $needle) { return ($needle === '' || mb_substr($haystack, -mb_strlen($needle)) === $needle); } } var_dump(str_ends_with('abc', '')); // true var_dump(str_ends_with('abc', ' ')); // false var_dump(str_ends_with('abc', 'c')); // true var_dump(str_ends_with('abc', 'C')); // false var_dump(str_ends_with('abc', 'c ')); // false var_dump(str_ends_with('abc', ' c')); // false var_dump(str_ends_with('abc', 'a')); // false ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.242 (proxied: 2a01:c23:6c07:c100:ec92:b1f2:a803:f6bc) ---- Manual Page -- https://php.net/manual/en/function.str-ends-with.php Edit -- https://main.php.net/note/edit/126172 Del: integrated -- https://main.php.net/note/delete/126172/integrated Del: useless -- https://main.php.net/note/delete/126172/useless Del: bad code -- https://main.php.net/note/delete/126172/bad+code Del: spam -- https://main.php.net/note/delete/126172/spam Del: non-english -- https://main.php.net/note/delete/126172/non-english Del: in docs -- https://main.php.net/note/delete/126172/in+docs Del: other reasons-- https://main.php.net/note/delete/126172 Reject -- https://main.php.net/note/reject/126172 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#216524) next »