关联数组中的值将不会打印 [英] Values in associative array will not print
本文介绍了关联数组中的值将不会打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
print_r($ item);
打印出来:
数组(['note'] => sample1 ['value'] => 4)
这个:
echo $ item ['value'];
echo $ item ['note'];
什么都不打印!
这是使用键的回声应该打印的内容。
我无法弄清楚这一点。我错过了什么?
我的尝试:
foreach($ item as $ i){
echo $ i;
}
打印上面的echo语句应该有:
4
sample1
解决方案
item);打印出来:
数组(['note'] => sample1 ['value'] = > 4)这个:
echo
item ['value'];
echo
item ['note'];什么都不打印!
这是使用键的回声应该打印的内容。
我无法弄清楚这一点。我错过了什么?
我的尝试:
的foreach(
print_r($item);
prints this:
Array ( ['note'] => sample1 ['value'] => 4 )
This:
echo $item['value']; echo $item['note'];
prints nothing!
Which is what the echo's using the keys should have printed.
I can't figure this out. What am I missing?
What I have tried:
foreach($item as $i) { echo $i ; }
prints as the above echo statements should have:
4
sample1
解决方案
item);prints this:
Array ( ['note'] => sample1 ['value'] => 4 )This:
echo
item['value']; echo
item['note'];prints nothing!
Which is what the echo's using the keys should have printed.
I can't figure this out. What am I missing?
What I have tried:
foreach(
这篇关于关联数组中的值将不会打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文