Bug #69340 [Opn->Nab]: trim($i, 0) and trim($i, '\0') is the same
| From: | bwoebi@php.net | Date: | Tue, 31 Mar 2015 12:53:58 +0000 |
| Subject: | Bug #69340 [Opn->Nab]: trim($i, 0) and trim($i, '\0') is the same | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-191751@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69340&edit=1
ID: 69340
Updated by: bwoebi@php.net
Reported by: nick dot sky dot pc at gmail dot com
Summary: trim($i, 0) and trim($i, '\0') is the same
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Windows 7
PHP Version: 5.4.39
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Like julien already described...
Previous Comments:
------------------------------------------------------------------------
[2015-03-31 12:04:23] julien at barmas dot name
Hi,
This is a normal case.
You should use double quotes to use escaped character codes.
'\0' is not equal to "\0".
'\0' means the string antislash zero, "\0" means ASCII NULL or chr(0)
Give a try to $i = trim($i, "\0"); or trim($i, chr(0));
Regards,
------------------------------------------------------------------------
[2015-03-31 11:46:53] nick dot sky dot pc at gmail dot com
Description:
------------
$i = 11000;
//$i = trim($i, 0);
//or
$i = trim($i, '\0');
//is the same
echo $i; //11
//Is there is bug? I expect is '\0' work as slash and zero, but not just zero
//PHP 5.4.32
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69340&edit=1