#47381 [Opn->Bgs]: Some expressions (of classes) don't behave logical
ID: 47381
Updated by: felipe@php.net
Reported By: t dot nickl at exse dot de
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: Ubuntu 8.10
PHP Version: 6CVS-2009-02-13 (snap)
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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)