|
Posted by Curt Zirzow on 09/27/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
Navigation:
[Reply to this message]
|