|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31026 Problem with type conversion
Submitted: 2004-12-08 20:37 UTC Modified: 2004-12-20 13:34 UTC
From: tobi at knmm dot de Assigned:
Status: Closed Package: Variables related
PHP Version: 4.3.10RC3-dev OS: Linux 2.6.8 (Debian sarge)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: tobi at knmm dot de
New email:
PHP Version: OS:


 [2004-12-08 20:37 UTC] tobi at knmm dot de
A very strange problem occurs on my webserver. If you run the provided code via a few times, in about 1 out of 10 times the second line of output is "$price is a double with value 34". This shows up randomly.
Running the script on the commandline of the same machine doesn't show this behaviour.


Reproduce code:
$price = '34.90';

echo "\$price is a ".gettype($price)." with value $price\n";
echo "\$price is a ".gettype($price)." with value $price\n";

(also available via

Expected result:
$price is a string with value 34.90
$price is a double with value 34.9

Actual result:
$price is a string with value 34.90
$price is a double with value 34


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-18 00:52 UTC] tobi at knmm dot de
Now, with the CVS version the script says '34,9' instead of 34.9 (with 4.3.9 it was only '34').
This solves my problem, which was that calculations with variables, type-converted from string to float had gone wrong sometimes. 
But it's still very strange.
I figured out that the problem only occurrs if the apache webserver with php on it already ran for a few hours.
 [2004-12-20 13:34 UTC]
Fixed -> closed.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Jan 18 06:01:24 2021 UTC