Last active
September 15, 2020 01:04
-
-
Save design-innovations/e3d714827165d66d1abe96c44834154d to your computer and use it in GitHub Desktop.
PHP - 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
<?php | |
$username = $_GET['user'] ?? 'nobody'; | |
// This is equivalent to: | |
// $username = isset($_GET['user']) ? $_GET['user'] : 'nobody'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment