Re: forcing variable declaration
| From: | (Hace) | Date: | Sat, 03 Nov 2001 10:04:13 +0000 |
| Subject: | Re: forcing variable declaration | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-10217@lists.php.net to get a copy of this message | ||
Tim Foster schreef:
>I've looked at the manual and php.ini file, but can't find what I'm looking for.
>Is there a way to make PHP force that variables be declared?
Turn on the E_WARNING flag in php.ini and you will get a warning for
every Var that's not initialised.
To not get these warnings you will have to declare and set them like:
var myvar=0;
>(In VBScript, variables do not have to be declared unless "OPTION EXPLICIT" appears at
>the
>top of the script. I'm wondering if PHP has an equivalent).
>
>I hate it when a typo creates a variable at run time and the script continues (and
>produces unwanted results).
http://www.php.net/manual/en/features.error-handling.php
Hace
--
http://hace.cjb.net