|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: panos at com2go dot com
New email:
PHP Version: OS:


 [2005-07-08 15:35 UTC] panos at com2go dot com
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:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-08 15:37 UTC]
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 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-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 21 00:01:30 2024 UTC