Extra Awesome PHP

So today I came across this extra useful snippet of code in the comments at the PHP docs site.

<?php  
    $var = 1;
    $var == 1 AND print('$var == 1');
?>

Which is actually the same as doing the usual:

<?php  
    $var = 1;
    if($var == 1) {
        print('$var == 1');
    }
?>

Super useful for quick checks.


comments powered by Disqus