Use nested foreach()
because it is 2D array. Example here
foreach($array as $key=>$val){
// Here $val is also array like ["Hello World 1 A","Hello World 1 B"], and so on
// And $key is index of $array array (ie,. 0, 1, ....)
foreach($val as $k=>$v){
// $v is string. "Hello World 1 A", "Hello World 1 B", ......
// And $k is $val array index (0, 1, ....)
echo $v . '<br />';
}
}
In first foreach()
$val
is also an array. So a nested foreach()
is used. In second foreach()
$v
is string.
Updated according to your demand
foreach($array as $val){
echo '<a href="'.$val[0].'">'.$val[1].'</a>';
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…