note 124137 deleted from language.operators.string by cmb
| From: | cmb@php.net | Date: | Sun, 25 Aug 2019 14:58:20 +0000 |
| Subject: | note 124137 deleted from language.operators.string by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212016@lists.php.net to get a copy of this message | ||
Note Submitter: ivan at trive dot digital
----
also similar example of caution for precedence, which may or may not be obvious from first note
<?php
$array = [
'message' => 1
];
echo 'Message is '
. isset($array['msg'])
? $array['msg']
: $array['message'];
?>
will throw an _Undefined index exception_ as
isset() has the same precedence as
concatenate.
place it in a variable before concatenating as a method to avoid this.