note 37183 deleted from language.variables.scope by cmb
| From: | cmb@php.net | Date: | Sun, 27 Oct 2019 08:29:05 +0000 |
| Subject: | note 37183 deleted from language.variables.scope by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212778@lists.php.net to get a copy of this message | ||
Note Submitter: flobee at gmx dot net
----
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!