Re: Why is there no OPTION EXPLICIT equivalent?
| From: | Andrew Brampton | Date: | Wed, 29 May 2002 19:43:30 +0000 |
| Subject: | Re: Why is there no OPTION EXPLICIT equivalent? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-99794@lists.php.net to get a copy of this message | ||
You can put your error level up to show you when you try to use a varible
that hasn't be initalised yet, I tend to do that to ensure good coding, and
that I don't mistype varibles etc
Andrew
----- Original Message -----
From: "Andy Arbon" <andy@andrewarbon.co.uk>
To: <php-general@lists.php.net>
Sent: Wednesday, May 29, 2002 8:11 PM
Subject: [PHP] Why is there no OPTION EXPLICIT equivalent?
> Hello,
>
> In general I find PHP great to work with, but the number one thing that
> causes bugs for me is the fact that the interpreter doesn't throw an
> error if I use an undeclared variable.
>
> I have looked and I can't find any information that suggests you can
> make PHP force you to declare variables before use - does such a
> facility exist?
>
> Assuming it doesn't, why is that the case? I can't be the only one who
> has problems with this; are there any plans to add such a feature in the
> future? It doesn't have to be compulsory, but a facility like VB's (not
> that I like that language in general) Option Explicit statement would be
> a great help.
>
> I know nothing about language design, but I can't see how this can be
> more difficult to do than forcing static types, which it seems you can
> do in PHP.. can anyone tell me the reasoning behind this?
>
> Hope the above doesn't sound too critical - in general I love PHP, but
> this one omission has cost me so many hours of debugging time over the
> years I had to ask :)
>
> Cheers,
>
> Andy
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>