Re: Null Coalesce Operator and Undefined Indexes
| From: | Jennifer | Date: | Mon, 27 Nov 2017 20:22:04 +0000 |
| Subject: | Re: Null Coalesce Operator and Undefined Indexes | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-326278@lists.php.net to get a copy of this message | ||
> On Nov 27, 2017, at 11:53 AM, David Harkness <david.h@highgearmedia.com> wrote:
>
> You must use the ?? operator on the array access before passing it to your
> sanitize() function.
>
> $ua = sanitize($_SERVER['HTTP_USER_AGENT'] ?? null);
So close... yet so far away. ;) Thank you, David!
Jenni