Hyvor Developer
  Home   Download   Copy
Code
<?php
$username = 'Hyvor';
echo 'Hello ' . ($username ?: 'Guest') . '<br>'; // hello hyvor, because $username returns true

$username = null;
echo 'Hello ' . ($username ?: 'Guest') . '<br>'; // hello guest, because $username returns null

// another example
$var = 5;
$isGreaterThan2 = $var > 2 ? true : false;
var_dump($isGreaterThan2);
Result