|  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
3 + 24 = ?
Subscribe to this entry?

 [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: Mon Jul 22 00:01:28 2024 UTC