Reply to Re: [PHP] Declaring arrays? Good practice?

Your name:

Reply:


Posted by Curt Zirzow on 10/23/28 11:34

On Tue, Dec 13, 2005 at 07:34:31PM -0800, Michael Hulse wrote:
> Sorry if this question sounds noobish:
>
> $foo = array(); // Declare first, good practice.
> $foo = array('one', 'two', 'three');
>
> Using above as example, is it good to always declare the array first?

Well there really isn't any "declaration" in php, it is how you
initialize the variable. By just doing a:

$foo = array('one', 'two', 'three');

It is an explicit intialization and we know that anytime in later
code this thing is going to be an array and returned as an array.
The need to define the var as an empty array first is just extra
unneeded work

Curt.
--
cat .signature: No such file or directory

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация