php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33616 The Answer to Life, the Universe and Everything = 41?
Submitted: 2005-07-08 15:35 UTC Modified: 2005-07-08 15:37 UTC
From: panos at com2go dot com Assigned:
Status: Not a bug Package: *Math Functions
PHP Version: 4.3.11 OS: Linux
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: panos at com2go dot com
New email:
PHP Version: OS:

 

 [2005-07-08 15:35 UTC] panos at com2go dot com
Description:
------------
While to trying to make a simple one line script that will display the answer to life, the universe, and everything I noticed that the answer comes up wrong if the equiation is concatenated with text. 

The text is not displayed instead 1 is subtracted from any mathimatical equation that is concatenated with any text.  It seems that PHP is not differentiating between text and integer and assigning the text a value of -1.     

You may consider this a 'feature' as text is assigned a value of -1 or FALSE and . is percived as +. However for that to be true "echo 1 . 1" should return "2" not "11"

Reproduce code:
---------------
print "What do you get if you multiply SIX by NINE: ". 1 + 5 * 8 + 1;

Expected result:
----------------
What do you get if you multiply SIX be NINE: 42

Actual result:
--------------
41

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-08 15:37 UTC] derick@php.net
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.

.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Oct 28 03:01:23 2020 UTC