Doc #78934 [Opn]: What do mbstring functions return when they fail?
| From: | requinix@php.net | Date: | Mon, 09 Dec 2019 00:11:38 +0000 |
| Subject: | Doc #78934 [Opn]: What do mbstring functions return when they fail? | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-17099@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78934&edit=1
ID: 78934
Updated by: requinix@php.net
Reported by: anthony_rutledge_101 at yahoo dot com
-Summary: What does mb_substr() return when it fails?
+Summary: What do mbstring functions return when they fail?
Status: Open
Type: Documentation Problem
-Package: Documentation problem
+Package: mbstring related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
As with most other PHP functions, if there is some sort of problem then it returns false.
Looks like others don't have this documented either.
Previous Comments:
------------------------------------------------------------------------
[2019-12-09 00:03:53] anthony_rutledge_101 at yahoo dot com
Description:
------------
---
From manual page: https://php.net/function.mb-substr
---
Hi. Short and sweet. Would you please add what mb_substr() returns when it fails to the manual page?
Thank you. I would have given you the answer, but my PHP 7.2.7 on Windows (legacy) does not have the
multi-byte extension installed. I'm moving to PHP 7.4 anyway.
Test script:
---------------
The manual is the issue, not the function (as far as I know).
Still, to save you time. :-)
mb_internal_encoding("UTF-8");
$name = "Anthony";
echo $name . "<br>";
$newName = mb_substr($name, 0, 7);
echo $newName . "<br>";
$badName = mb_substr($name, 0, 20);
echo $badName . "<br>";
$badName = mb_substr($name, 20, 20);
echo $badName . "<br>";
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78934&edit=1