Re: Re: Expression evaluation - how is it done?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



BTW, that's called Short Circuiting.

B.A.T. Svensson wrote:

I asking because i read through the section about expression, but it
was just wining about that $a == 5 if $a = $b and $b = 5, and other
trivial matters. So if you could point me to the manual section you
are referring to, I would appreciate it.

Anyhow, I take your answer that PHP is doing a left-to-right-hand
evaluation of the expression, and stops when it not needed to
evaluate it further. i.e. in the same way as in C/C++.

Thanks for the answer, that all I need to know (for now:).


//Anders



On Thu, 2004-03-18 at 13:12, DvDmanDT wrote:


It's done the lazy way.. If the whole expression can't return true, it's not
nessecary to evaluate the right side of the && operator.. In other words,
my_bool_function will never be called...

See the manual for more..

--
// DvDmanDT
MSN: dvdmandt$hotmail.com
Mail: dvdmandt$telia.com
"B.A.T. Svensson" <B.A.T.Svensson@xxxxxxx> skrev i meddelandet
news:1079610737.30259.20.camel@xxxxxxxx

Does PHP uses the same expression evaluation as in C/C++?

This questions also consider expression with function
that returns booleans, typical:


if (false && my_bool_function())



Will my_bool_function() be evaluated or not in this case?


--
paperCrane <Justin Patrin>

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux