note 105577 deleted from language.expressions by danbrown

From: Date: Mon, 29 Aug 2011 20:10:22 +0000
Subject: note 105577 deleted from language.expressions by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182815@lists.php.net to get a copy of this message
Note Submitter: Thierry Husson ---- Simple trick to current need: I want to get a function result in a variable or another value if it is empty. Instead of a long if then else structure like: $x = myFunction($y); if (empty($x)) x$ = otherFunction($z) or a slow or dangerous execution duplication like: $x = (empty(myFunction($y)) ? otherFunction($z) : myFunction($y)); you can use the short and easy to read syntax: if (! $x = myFunction($y)) x$ = otherFunction($z);

« previous php.notes (#182815) next »