-
-
Save DomPixie/7a7e36980b2d73aaa9bcdc94215b6666 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