Re: [PHP4BETA] Problem with unset()
| From: | Zeev Suraski | Date: | Wed, 28 Jul 1999 05:44:26 +0000 |
| Subject: | Re: [PHP4BETA] Problem with unset() | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-2885@lists.php.net to get a copy of this message | ||
Once you unset() $MyArray(), it no longer exists, and the global reference doesn't apply to it anymore.
Zeev
At 03:13 28/07/99 , Ken Leshner wrote:
Hi guys, When I execute the following script, I get the message - Warning: Variable passed to each() is not an array or object in ... Also try it after commenting out the unset() function. --Ken <? function doArray() {-- Zeev Suraski <zeev@zend.com> http://www.zend.com/ For a PGP public key, finger bourbon@netvision.net.ilglobal $MyArray;unset($MyArray);$MyArray[] = "abc"; $MyArray[] = 2; $MyArray[] = "def";return;}doArray();?> Array Test <? while (list($key, $value) = each($MyArray)) printf("Key: %s, Value: %s ", $key, $value); ?> -- PHP 4 Beta