布尔值的快速计算

PHP 3.0 中的布尔值采取了快速计算的方法。这就意味着如同 (1 || test_me()) 的表达式将不会执行函数 test_me()。因为这个表达式的值始终为 1

这只是一个很小的兼容性问题,但是会造成一些意想不到的结果。


add a note add a note User Contributed Notes
php at cotest dot com
18-Jul-2002 02:13
"Short-circuiting" is often called "lazy evaluation," too.