Loving the Ternary Operator

$staffName = isset($_GET[‘staffName’]) ? $_GET[‘staffName’] : $staffName = ”;

or even shorter

$staffName = $_GET[‘staffName’] ?: $staffName = ”;

instead of

if(isset($_GET[‘ckDone’])){$ckDone = ‘checked’;} else {$ckDone = ”;}

See this article.

Leave a Reply