#47381 [Bgs]: Some expressions (of classes) don't behave logical

From: Date: Mon, 16 Feb 2009 09:58:04 +0000
Subject: #47381 [Bgs]: Some expressions (of classes) don't behave logical
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-133865@lists.php.net to get a copy of this message
 ID:               47381
 User updated by:  t dot nickl at exse dot de
 Reported By:      t dot nickl at exse dot de
 Status:           Bogus
 Bug Type:         *General Issues
 Operating System: Ubuntu 8.10
 PHP Version:      6CVS-2009-02-13 (snap)
 New Comment:

Thank you!


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

[2009-02-13 21:11:32] felipe@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php



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

[2009-02-13 13:34:46] t dot nickl at exse dot de

Description:
------------
class A
{
        public function getName()
        {
                return("a");
        }
}

//Issue 1:
//This produces "syntax error, unexpected T_OBJECT_OPERATOR":
echo new A()->getName();

//This works:
$_= new A();
echo $_->getName();


//Issue 2:
//This produces "Can't use function return value in write context":
$b= " a";
var_dump(empty(trim($a)));

//This works:
$b= " a";
$_= trim($a);
var_dump(empty($_));



//In php, I must assign an expression to a variable first 
// before being able to use it at some points? Why?



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


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



Thread (3 messages)

« previous php.bugs (#133865) next »