note 114671 added to language.variables.basics
| From: | jeff12 at fastpitchcentral dot com | Date: | Thu, 20 Mar 2014 19:38:03 +0000 |
| Subject: | note 114671 added to language.variables.basics | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198989@lists.php.net to get a copy of this message | ||
While the recommendation here is to initialize variables, there is a very good reason to definitely
initialize variables.
I just had the unpleasant task of making numerous folks happy that the Apache "error_log"
is now much smaller. We had over 1500 variables that showed up as "error" in the
error_log file. In many cases just one uninitialized variable might cause 10s or 100s of thousands
of records to be entered in the "error_log".
While it may not be necessary to initialize variables, there can be a significant cost if you do not
do so.
And no, that website was not willing to lower the bar and not write to the "error_log"
file if it was simply a case of uninitialized variables. It was also the case that in a small
percentage of cases the variables newly initialized caused me to scratch my head and conclude that
a blank or zero might cause different logic to occur.
----
Server IP: 72.52.91.14
Probable Submitter: 24.98.27.207
----
Manual Page -- http://php.net/manual/en/language.variables.basics.php
Edit -- https://master.php.net/note/edit/114671
Del: integrated -- https://master.php.net/note/delete/114671/integrated
Del: useless -- https://master.php.net/note/delete/114671/useless
Del: bad code -- https://master.php.net/note/delete/114671/bad+code
Del: spam -- https://master.php.net/note/delete/114671/spam
Del: non-english -- https://master.php.net/note/delete/114671/non-english
Del: in docs -- https://master.php.net/note/delete/114671/in+docs
Del: other reasons-- https://master.php.net/note/delete/114671
Reject -- https://master.php.net/note/reject/114671
Search -- https://master.php.net/manage/user-notes.php