Bug #69340 [Com]: trim($i, 0) and trim($i, '\0') is the same
| From: | julien at barmas dot name | Date: | Tue, 31 Mar 2015 12:04:24 +0000 |
| Subject: | Bug #69340 [Com]: trim($i, 0) and trim($i, '\0') is the same | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-191750@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
Comment by: julien at barmas dot name
Reported by: nick dot sky dot pc at gmail dot com
Summary: trim($i, 0) and trim($i, '\0') is the same
Status: Open
Type: Bug
Package: *General Issues
Operating System: Windows 7
PHP Version: 5.4.39
Block user comment: N
Private report: N
New Comment:
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,
Previous Comments:
------------------------------------------------------------------------
[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