|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-02-13 21:11 UTC] felipe@php.net
[2009-02-16 09:58 UTC] t dot nickl at exse dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 17 12:00:02 2025 UTC |
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?