Я использую Null Coalessing оператора PHP, описанный http://php.net/manual/en/migration70.new-features.php.
Null coalescing operator ¶
The null coalescing operator (??) has been added as syntactic sugar for the common case of needing to use a ternary in conjunction with isset(). It returns its first operand if it exists and is not NULL; otherwise it returns its second operand.
< /code>
Я заметил, что следующее не дает моих ожидаемых результатов, которые должны были добавить новый телефон < /code> к индексу в $ params < /code> чье значение «по умолчанию». < /p>
$params=['address'=>'123 main street'];
$params['phone']??'default';
< /code>
Почему бы и нет? < /p>
Подробнее здесь: https://stackoverflow.com/questions/533 ... n-an-array