Re: Variable declaration

From: Date: Thu, 27 Sep 2001 08:24:52 +0000
Subject: Re: Variable declaration
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-68966@lists.php.net to get a copy of this message
> Like I said, that line does both. It sets the type internally to an > integer and assigns the value. > > -Rasmus What he (Alberto) is looking for, and what I would prefer to, is to really explicitly declare a variable. There's a difference between a compiler that requires you to declare (integer $Test;) a variable _before_ you start using it ($Test = 3;). Ofcourse I know that PHP internally declares it, but it's not the same thing. When the compiler forces you to declare all variables you're gonna use it gives a better view of which variables are used in the script, and besides that it doesn't allow you to make any mistakes of using undefined variables like it does now. The PHP compiler doesn't really check your code intensively. You can use any variable without the compiler complaining. Only at the moment that it reaches the variable and finds out it isn't defined, it tells you. It would be better to explicitly have to declare the variable. When the compiler starts it then shouldn't execute the code when it contains any variable that is not explicitly declared. But like I said, FAFAIK explicitly declaring variables isn't supported by PHP :( -- * R&zE: -- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: renze@datalink.nl -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- ««««««««««««««««««««««««

« previous php.general (#68966) next »