Re: Looking for an explanation
| From: | David Tulloh | Date: | Tue, 20 Jun 2006 23:45:06 +0000 |
| Subject: | Re: Looking for an explanation | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-24167@lists.php.net to get a copy of this message | ||
Oliver Block wrote:
> Hello list,
>
> as you are familiar with the source code of php it might be easy to explain
> how the brain of php interprets the following code:
I think that this would be better suited to the startard PHP list. I
would suggest posting any further followups there.
>
> print ($life = "hard") -1;
($life="hard") assigns "hard" to $life and returns "hard"
"hard" -1 casts "hard" to an integer to do a math operation, "hard"
casts to 0
0 -1 is -1, so -1 is printed
> print "\nlife: {$life}\n";
Now you simply print the value of $life, "hard"
David