ID:          45320
 Updated by:  [EMAIL PROTECTED]
 Reported By: reto at buxaprojects dot com
-Status:      Open
+Status:      Bogus
 Bug Type:    Scripting Engine problem
 PHP Version: 6CVS-2008-06-20 (snap)
 New Comment:

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

$a ?: $b; is equivalent to $a ? $a : $b;

so in your code:
!empty($var) ?: 'Nothing' 
is equivalent to :
!empty($var) ? !empty($var) : 'Nothing';
and not
!empty($var) ? $var : 'Nothing';


Previous Comments:
------------------------------------------------------------------------

[2008-06-20 08:12:27] reto at buxaprojects dot com

Description:
------------
The Ternary-Operator shortcut doesn't do the same with empty()

Reproduce code:
---------------
ini_set('display_errors', true);
error_reporting(E_ALL|E_STRICT);

$var = 'Something';

echo !empty($var) ? $var : 'Nothing';
echo !empty($var) ?: 'Nothing';

Expected result:
----------------
SomethingSomething

Actual result:
--------------
Something1


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45320&edit=1

Reply via email to