Tag Archives: PHP

PHP best practice: always wrap conditional statement in closing brackets

This has caught me today, so I thought I’d write this down here so it’d stuck in my head.
Check out this code:

$p = ‘abcd’.($b)?‘e’:‘f’;

What would $p be if $b is true and what would it be if $b is false?

Posted in PHP | Also tagged | Leave a comment