Skip to content
Advertisement

using PHP’s null coalescing operator on an array

I am using PHP’s null coalescing operator described by http://php.net/manual/en/migration70.new-features.php.

JavaScript

I noticed the following doesn’t produce my expected results which was to add a new phone index to $params whose value is “default”.

JavaScript

Why not?

Advertisement

Answer

You don’t add anything to params. Your given code simply generates an unused return value:

JavaScript

Thus, you will still have to set it:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement