Please answer this simple SPAM challenge: max(six, eight)?
(Example: nine)

The Note You're Voting On

niels dot laukens at tijd dot com
13 years ago
For the people that know C: php uses operator short circuit evaluation. That means that as soon as it knows the outcome, it'll stop processing.

if ( FALSE && some_function() )
// some_function() will not be called, since the first operand evaluates to false

This comes in handy for situations like this:

if ( file_exists($filename) && filemtime($filename) > time() )
// filemtime will never give a file-not-found-error, since php will stop evaluating if file_exists returns false

<< Back to user notes page

To Top