note 37183 added to language.variables.scope
| From: | flobee at gmx dot net | Date: | Thu, 06 Nov 2003 05:26:38 +0000 |
| Subject: | note 37183 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59972@lists.php.net to get a copy of this message | ||
i found out that on any (still not found) reason the <?php static $val =NULL; ?> is not
working when trying to extract the data form the $var with a while statment
e.g.:
<?php
funktion get_data() {
static $myarray = null;
if($myarray == NULL) {
//get some info in an array();
$myarray = array('one','two');
}
while(list($key,$val) = each( $myarray ) ) {
// do something
echo "x: $key , y: $val";
}
}
?>
when using foreach($myarray AS $key => $val) { .... instad of while then i see the result!
----
Manual Page -- http://www.php.net/manual/en/language.variables.scope.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37183
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37183&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37183&report=yes
Search -- http://master.php.net/manage/user-notes.php