|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #82 type conversion string to number
Submitted: 1998-02-19 04:20 UTC Modified: 1998-02-19 09:12 UTC
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: Brian dot Craigie at necs dot demon dot co dot uk Assigned:
Status: Closed Package: Other
PHP Version: 3.0 Latest CVS OS: Solaris 2.5
Private report: No CVE-ID: None
 [1998-02-19 04:20 UTC] Brian dot Craigie at necs dot demon dot co dot uk
I'm using PHP3 cvs version as of 17th feb.  This isn't really a bug IMO, but it's odd.

Using the code:-




echo "dbg=$dbg<P>\n";





Yet (6+5-0)*4 = 44

Now, I know the code is wrong because I'm assigning string values to $Y1 and $Y2, but why does it not convert the values correctly?

I've now fixed my code by removing the quotes from around the numbers, and the calculation is then correct.

I suppose I don't want a bug fix so much as to know why an implicit string to number conversion didn't work.




Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1998-02-19 09:12 UTC] zeev
The plus operator is overloaded for strings
 [2020-05-07 13:12 UTC]
Automatic comment from SVN on behalf of nikic
Log: Remove useless declare statement from example

Patch by SjonHortensius.

Closes php/doc-en#82.
 [2021-09-03 09:50 UTC]
Automatic comment on behalf of sy-records
Log: Fix typo
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 22 12:01:29 2024 UTC