Created
December 1, 2019 11:30
-
-
Save jenovateurs/9e2ab68edc80fe40f45f383cae436dbb to your computer and use it in GitHub Desktop.
Nouveauté PHP 7.4 - Opérateur d’assignation Coalesce Null
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 | |
$_POST['ville'] = $_POST['ville'] ?? 'Lyon'; | |
echo $_POST['ville'] . "\n"; | |
$_POST['ville'] ??= 'Lyon'; | |
echo $_POST['ville'] . "\n"; | |
// Equivalent de | |
if (false === isset($_POST['ville'])) { | |
$_POST['ville'] = 'Lyon'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment