3v4l.org

run code in 300+ PHP versions simultaneously
<?php $expr1 = null; $expr2 = 'expr2'; $expr3 = 'expr3'; $result = ($expr1) ? ($expr2) : ($expr3); var_dump($result); if (true === $expr1) { $result = $expr2; } else { $result = $expr3; } var_dump($result); $result = ($expr1) ?: ($expr3); var_dump($result); if (true === $expr1) { $result = $expr1; } else { $result = $expr3; } var_dump($result); $result = ($expr1) ?? ($expr3); var_dump($result); if (null !== $expr1) { $result = $expr1; } else { $result = $expr3; } var_dump($result);

preferences:
62.59 ms | 404 KiB | 5 Q