note 11826 added to function.compact.php
| From: | php-general at lists dot php dot net | Date: | Thu, 08 Mar 2001 19:48:59 +0000 |
| Subject: | note 11826 added to function.compact.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-12053@lists.php.net to get a copy of this message | ||
It looks like this function is identical to doing this:
Using compact():
----------
$name = "chris";
$array( "joe" => "bob", "this" => "that" )
compact( "name", $array );
----------
Not using compact():
----------
$array[name] = $name;
Or am I missing something? If it is the same, why would you ever use compact()? Except for
possibly adding more than one element to an array at a time?
Chris
http://www.php.net/manual/en/function.compact.php