|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23400 "print(2 or 3)" returns wrong result
Submitted: 2003-04-29 02:29 UTC Modified: 2003-04-30 02:43 UTC
From: akukula at min dot pl Assigned:
Status: Not a bug Package: *Programming Data Structures
PHP Version: 4.3.1 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.
Block user comment
Status: Assign to:
Bug Type:
From: akukula at min dot pl
New email:
PHP Version: OS:


 [2003-04-29 02:29 UTC] akukula at min dot pl
Bash command line:
$ echo '<?php print(2 or 3) ?>' | php
The result is 1
$ echo '<?php $i = 2 or 3; print($i) ?>' | php
The result is 2
According to documentation (e.g. the chapter on operators)
it should return '2' in both examples.

Kind regards,
Andrzej Kukula


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-29 10:39 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. 

Thank you for your interest in PHP.

This is definately not bug. 
 [2003-04-30 02:43 UTC] akukula at min dot pl
Okay, sorry for the mistake, I have misunderstood that "or" returns it first or second argument instead of true/false. This is my mistake. Please close that bug.

Besides, it's a pity that there's no operator that allows me to:
$var = $user_entered_value or "default";

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Feb 24 06:01:29 2024 UTC