php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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

Patches

Pull Requests

History

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

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";
...

Regards,
Andrzej
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC