如何呼应出这个数组的值? [英] How to echo out the values of this array?
本文介绍了如何呼应出这个数组的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何单独回声出值这个数组的?
阵列([0] => 20120514 [1] =>我的事件3)
所以
回声$值[0];等等
我有这个至今:
的foreach(json_de code($ json_data_string,真)为$项){$ EVENTDATE =修剪($项目['日期']); //正限位 $ myArray的=(爆炸('',$ EVENTDATE,2));的foreach($ myarray中为$值){
回声$价值;
}
此呼应的出整个字符串没有作为数组。如果我做到这一点?
回声$值[0};
然后我只得到它的2个字符?
编辑:
该print_r的:
阵列([0] => 20120430 [1] =>我的事件1)
感谢
克里斯
解决方案
的foreach($数组$关键=> $ VAL){
回声$ VAL;
}
How to echo out the values individually of this array?
Array ( [0] => 20120514 [1] => My Event 3 )
so
echo $value[0]; etc
I have this so far:
foreach (json_decode($json_data_string, true) as $item) {
$eventDate = trim($item['date']);
// positive limit
$myarray = (explode(',', $eventDate, 2));
foreach ($myarray as $value) {
echo $value;
}
This echo's out the whole string no as an array. and if i do this?
echo $value[0};
Then i only get 2 characters of it??
EDIT:
The print_r :
Array ( [0] => 20120430 [1] => My Event 1 )
Thanks
Chris
解决方案
foreach ($array as $key => $val) {
echo $val;
}
这篇关于如何呼应出这个数组的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文