Re: Re: PHP5/ZE2: variables definition, constant variables
| From: | Andrey Hristov | Date: | Fri, 03 Jan 2003 14:16:05 +0000 |
| Subject: | Re: Re: PHP5/ZE2: variables definition, constant variables | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-93085@lists.php.net to get a copy of this message | ||
Hi,
To rephrase Zeev :
"Use error_reporting(E_ALL)"
Once you start using it most of the errors from undefined variables will go
to oblivion.
Your example is too fictional
errors like $$var_name or $foo->$mCount are easy to find with the method
above.
Andrey
----- Original Message -----
From: "Victor Toni" <php-mail@vitoni.de>
To: <php-dev@lists.php.net>
Cc: "Leon Mergen" <leon@antrophia.com>
Sent: Friday, January 03, 2003 3:53 PM
Subject: [PHP-DEV] Re: PHP5/ZE2: variables definition, constant variables
> > > What I do not like about PHP variables, is that they do not have to be
> > > defined before use.
> >
> > Well, this definately is plainly a choice. One of PHP's "goals" is to be
> > very easy to learn. Many people programming PHP have never ever
programmed
> > before. For them, it is VERY easy to learn, because these kind of things
> > (variable declaration) are not dealt with.
>
> Indeed it is very easy to learn, but sometimes it is not very easy to
> debug,
> because there is no indication for missing declarations (or spelling
> errors).
> And the actual style has exceptions: var is used to declare variables
> for classes,
> but I cannot use it to declare var's for functions (or ensure I use only
> declared var's).
> There is also a difference between accessing a variable, static or
> constant.
>
> <?PHP
> class foo {
> var $bar_v = "variable";
> const bar_c = "constant";
> static $bar_s = "static";
> }
>
> $fooo = new foo();
> $bar_v = "bar_v";
>
> print $fooo->bar_v; // these 2 work different
> print $fooo->$bar_v;
>
> print foo::bar_c; // then these 2
> print foo::$bar_s;
>
> ?>
>
>
> Regards,
>
> Victor Toni
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
>