Skip to content
Advertisement

Tag: ternary

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. I noticed the following doesn’t produce my expected results which was to add a new phone index to $params whose value is “default”. Why not? Answer You don’t add anything to params. Your given code simply generates an unused return value: Thus, you will still have to set it:

Advertisement