Created
February 22, 2020 00:37
-
-
Save DominicWatts/badd9edf2c554fc5936385844ceb3884 to your computer and use it in GitHub Desktop.
Null coalescing operator (??)
This file contains 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
$action = $_POST['action'] ?? 'default'; | |
// The above is identical to this if/else statement | |
if (isset($_POST['action'])) { | |
$action = $_POST['action']; | |
} else { | |
$action = 'default'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment