Re: Is there an RTFM for 'use strict' ?
| From: | CPT John W. Holmes | Date: | Mon, 23 Jun 2003 14:01:34 +0000 |
| Subject: | Re: Is there an RTFM for 'use strict' ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-152498@lists.php.net to get a copy of this message | ||
> Done a lot of Perl & PHP coding over the years and one thing I _really_
> liked about Perl is its 'use strict;' directive. For those of you not
> familiar with Perl, this made the script die if you don't (among other
> things) declare your variables before using them.
>
> Once the fingers are flying, stupid typing mistakes often come in and
> it is more often when a variable name is being typed. It would be
> interesting to see how many PHP coders out there have spent ages trying
> to find a bug in their code that was due to them mis-spelling a variable
> or method name.
>
> Anyway, I can't find a reference to anything in the manual that will
> force PHP to strictly check variable names etc. to see if they are
> declared before use and if not throw up an error.
>
> Can somebody tell me which M to FR ?
The closest you can come is to set your error_reporting() to E_ALL. Then
you'll get notices about undefined variables and keys for arrays, but the
script will not die. You can do some FR at www.php.net/error_reporting. :)
---John Holmes...