#23400 [Bgs]: "print(2 or 3)" returns wrong result

From: Date: Wed, 30 Apr 2003 07:43:38 +0000
Subject: #23400 [Bgs]: "print(2 or 3)" returns wrong result
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38786@lists.php.net to get a copy of this message
ID: 23400 User updated by: akukula at min dot pl Reported By: akukula at min dot pl Status: Bogus Bug Type: *Programming Data Structures Operating System: Linux PHP Version: 4.3.1 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2003-04-29 10:39:30] 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-29 02:29:17] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23400&edit=1

« previous php.bugs (#38786) next »