$bbbb=array("11"=>"aaa","22"=>"bbb");
//方式一:只能输出值value不能输出key
foreach($bbbb as $color)
echo $color;
//方法二:value与key都可输出
foreach($bbbb as $key=>$value)
echo $key."=>".$value;
//方法三:value与key都可输出
while($color=each($bbbb)){
echo $color['key'];
}
print_r()
var_dump()
<?
$a = array (1, 2, array ("a", "b", "c"));
var_dump ($a);
?>
输出结果:
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
array(3) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
}
}