|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10734 Strange conversion string->numbers
Submitted: 2001-05-08 11:26 UTC Modified: 2001-05-10 08:58 UTC
From: konrad at interdata dot net dot pl Assigned:
Status: Closed Package: *General Issues
PHP Version: 4.0.5 OS: Linux 2.2 glibc-2.2.1
Private report: No CVE-ID: None
 [2001-05-08 11:26 UTC] konrad at interdata dot net dot pl
Here is a simple code

header("content-type: text/plain");

$num = -5;
echo "$num\n";
echo "$num\n";
echo "$num\n";
echo "----------\n";

$num = "-5";
echo "$num\n";
echo "$num\n";
echo "$num\n";

And here results

-6 <-- ?????????????????

It looks like "++" operator do not work properly on variables enclosed in double-quotes.
Other operators (ie $num = $num +1) woks properly.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-08 11:44 UTC]
AFAIR this is some strange magic borrowed from perl

the deeper sense in this is that you can use it
to increment/decrement the numerical part of
serial numbers and such

IMHO this is more confusing then helpfull and
should be nuked 
 [2001-05-10 08:58 UTC]
Fixed in the CVS.  Thanks for the report!
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Sep 28 05:01:24 2023 UTC