function - PHP - if (condition) execution -


let's have this:

if(1 == 0 && do_stuff()) {     ... } 

obviously 1 not 0, there's no point check other condition. php ever run do_stuff() ?

no - php uses lazy evaluation (sometimes called short-circuit evaluation), if first condition in logical , false, won't attempt evaluate of other conditions.

likewise, if doing or , first condition true wouldn't evaluate second.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -