NYCPHP Meetup

NYPHP.org

[nycphp-talk] upgrading to php5

Carlos A Hoyos cahoyos at us.ibm.com
Fri May 19 11:35:15 EDT 2006


> I may be preaching to the choir but at the heart of math and
> computer science is the concept that all sets include a null (or
> empty set). In CS this equates to all values, unless explicated
> prohibited, include a null value. Is
>
> $A = array();
>
> not a valid array even though null?

It is, and if you use array_merge with an empty array like the one above,
the results will be as expected. The whole confusion around array_merge is
regarding passing parameters that are non arrays. In php 4, these would
just be disregarded, while in PHP 5 the function will return NULL (an
undefined variable).

Also, keep in mind that array() is different from NULL. The first one
represents an empty array, while the latter is a variable that has no
value.

Carlos Hoyos




More information about the talk mailing list