Coalescing PHP – Elegant PHP coding
Coalescing can be chained: this will return the first defined value out of $_GET[‘user’], $_POST[‘user’], and ‘nobody’.
source : http://php.net/manual/en/migration70.new-features.php
Coalescing can be chained: this will return the first defined value out of $_GET[‘user’], $_POST[‘user’], and ‘nobody’.
$username = $_GET[‘user’] ?? $_POST[‘user’] ?? ‘nobody’;
source : http://php.net/manual/en/migration70.new-features.php
Comments