LoginSignup
5

More than 5 years have passed since last update.

posted at

PHP NULL合体演算子

PHP7からNULL合体演算子が追加されたので書き方メモ

//$_GET['user']が存在すれば$usernameに代入。nullならnobodyを代入
$username = $_GET['user'] ?? 'nobody';

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
5