Assignment in Conditional - How are they evaluated?
| From: | Mark Skilbeck | Date: | Thu, 29 Oct 2009 13:58:30 +0000 |
| Subject: | Assignment in Conditional - How are they evaluated? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-299497@lists.php.net to get a copy of this message | ||
How is the following evaluated:
[code]
if ($data = somefunc()) ...
[/code]
Ignoring the 'assignment inside condition' arguments, is the return value of somefunc() assigned to $data, and then $data's value is evaluated (to true or false), or is the actual assignment tested (does the assignment fail, etc)?