Scope of php array?
adolphe_ss
adolphe_ss 2017-11-16 21:10:12
0
3
1455

The poster has done too much research, maybe the keyword description is incorrect and no corresponding explanation was found.

I will post the picture first:

捕获2.PNG

That’s about it, why can print_r output, but there is no output in echo? Good people have a safe life, maybe I don’t understand the scope well...

adolphe_ss
adolphe_ss

reply all(2)
电动小老虎

each can traverse the array and then assign the array to a variable. Then the variable becomes an array. list can turn the elements of the default index array into variables such as $arr= range(1,3) list($a,$b,$c)=$arr echo $a,$b,$c is 1,2,3 That's probably what it means.

  • reply Each traversing the array will return 4 elements 0, 1, key, value; And the array pointer will automatically move downwards
    电动小老虎 author 2017-11-17 00:08:53
adolphe_ss
<hr size="5px" width="90%"/>
<?php
static $arr = array("张三","李四");
$name = each($arr);
print_r($name);echo '<br />';
$name = each($arr);
print_r($name);echo'<br />';
?>
<hr size="3pt" color="green"  width="50%" />
<?php
print_r($arr);
//$arr =array("张三","李四");
list($key, $value) = each($arr);
echo "$key=>$value";
?>

Attachment: The code of Figure 2.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template