Re: Scripting practices
| From: | Mattias Thorslund | Date: | Fri, 23 Apr 2004 21:01:42 +0000 |
| Subject: | Re: Scripting practices | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184469@lists.php.net to get a copy of this message | ||
I use precisely what you suggest. If you later find out you'd like to
wrap a few lines inside a loop, this avoids a potential bug when a
variable is not reset to the initial value for each iteration.
On Fri, 2004-04-23 at 13:55, Gabe wrote:
> When scripting in a language (such as PHP) that doesn't require you to
> determine the variable type before you use it, is it still considered
> good technique to initialize it to the type you're going to use it as?
> Or is it considered ok to just use it?
>
> e.g.
>
> $strText = ""; //initialize
> $strText = "now i'll give it a useful value";
>
> Or is it just better to skip the first line? Just curious, thanks!
>
> Gabe