Problem with unset()
| From: | Ken Leshner | Date: | Wed, 28 Jul 1999 01:13:06 +0000 |
| Subject: | Problem with unset() | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-2884@lists.php.net to get a copy of this message | ||
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()
{
global $MyArray;
unset($MyArray);
$MyArray[] = "abc";
$MyArray[] = 2;
$MyArray[] = "def";
return;
}
doArray();
?>
<html><head><title>Array Test</title></head>
<body>
<h1>Array Test</h1>
<?
while (list($key, $value) = each($MyArray))
printf("Key: %s, Value: %s<br>", $key, $value);
?>
</body></html>