/ php

PHP Ternary note

Note to self.

$a = null;

echo $a ? 'a' : 'b'; returns b;


$a = 0;

echo $a ? 'a' : 'b'; returns b;


$a = 1;

echo $a ? 'a' : 'b'; returns a;

PHP Ternary note
Share this