note 77997 deleted from function.set-error-handler by cmb
| From: | cmb@php.net | Date: | Sun, 13 Oct 2019 07:40:39 +0000 |
| Subject: | note 77997 deleted from function.set-error-handler by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212596@lists.php.net to get a copy of this message | ||
Note Submitter: michal dot kocarek at NO_SPAM dot seznam dot cz
----
Be aware of efficiency and speed of your scripts!
If you use old-fashioned non-strict variable calling (example follows...), your custom error handler
function degrades the script speed very big (especially for bigger projects). Because of for every
"use of undefined constant" or "undefined variable" E_NOTICEs will be called
your own custom error handler function.
<?
if ($form_variable) { ///< E_NOTICE Undefined variable
// process form stuff
}
$foo[bar] = $const_array[baz]; ///< 2x E_NOTICE Use of undefined constant bar, baz
if (!$d) { // declare default $d ///< E_NOTICE Undefined variable
$d = 5;
}
?>
As you can see in this poor example, badly writted scripts decrease the performace very big
'cause of the error handler is called almost everytime. So use custom-error-handler on heavily
used pages only if you are writing scripts strictly. (Example follows:)
<?
if (isset($form_variable) && $form_variable != null) {
// process form stuff
}
$foo['bar'] = $const_array['baz'];
if (!isset($d) || $d == null) {
$d = 5;
}
?>