Last active
August 11, 2022 03:39
-
-
Save rdp77/3478f7636f4c9081c448122f0a7b8fdc to your computer and use it in GitHub Desktop.
Null Safety Handle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$a = null; | |
// Old Way | |
if(!$a){ | |
echo "Hello World"; | |
} | |
else{ | |
echo $a; | |
} | |
// New Way | |
echo $a ?? "Hello World"; // New Text if variable is NULL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment