Re: POST variable and PHP 7
| From: | Paul M Foster | Date: | Wed, 29 Apr 2020 21:56:45 +0000 |
| Subject: | Re: POST variable and PHP 7 | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-327122@lists.php.net to get a copy of this message | ||
On Wed, Apr 29, 2020 at 04:26:53PM -0400, Aziz Saleh wrote:
> Hey Paul!
> Are you sure its an error or a notice? I can see you getting a notice if
> the item isn't set but not an error.
> Also this is expected behavior for a long while, it could have been the
> case that error reporting on php5 didn't show notices by default when php7
> does.
> You can hide notices on php7 via error reporting, but I would not
> recommend it and instead check for the value before using.
I didn't pay a lot of attention; it probably was a notice. However, I'm
pretty merciless with myself. I have my error reporting turned way up.
If PHP complains at all about anything, I want to know about it, and
repair it. In fact, when I switched my Apache server over to PHP 7, I
can't tell you how many errors/notices/warnings I got, using code from
the PHP 5 days.
You used to be able to do this, for example:
echo "Pizza: $pizza[flavor]";
Not anymore. Now I do:
echo "Pizza: {$pizza['flavor']}";
Paul
--
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com