0
私は次のような配列を持っています:$array1
私は配列の値を表示するためにループを使用しています。私はすべての配列の値を表示したい。配列を特定の方法で表示したい
$tree = array);
foreach ($array1 as $store_info) {
$tree[$store_info['storename']][] = array(
'0' => $store_info['0'],
'thumbnail' => $store_info['thumbnail'],
);
}
print_r($tree);
は、あなたがそこから残りの部分を把握することができます願っています:あなたが最初の配列を変換する必要が
Slovenly Europe
1. [0] => /7/0/702-100_thumb-sm_1.jpg
[thumbnail] => /7/0/702-100_thumb-sm_1.jpg
2. [0] => /7/0/702-100_thumb-sm_1.jpg
[thumbnail] => /7/0/702-100_thumb-sm_1.jpg
Greece
1. [0] => /7/0/702-100_thumb-sm_1.jpg
[thumbnail] => /7/0/702-100_thumb-sm_1.jpg
2. [0] => /7/0/702-100_thumb-sm_1.jpg
[thumbnail] => /7/0/702-100_thumb-sm_1.jpg
3. [0] => /7/0/702-100_thumb-sm_1.jpg
[thumbnail] => /7/0/702-100_thumb-sm_1.jpg
foreach($array1 as $v){
$v['storename']; }
$array1 = Array
(
[0] => Array
(
[0] => /7/0/702-100_thumb-sm_1.jpg
[thumbnail] => /7/0/702-100_thumb-sm_1.jpg
[storename] => Slovenly Europe
)
[1] => Array
(
[0] => /7/0/702-100_thumb-sm_1.jpg
[thumbnail] => /7/0/702-100_thumb-sm_1.jpg
[storename] => Slovenly Europe
)
[2] => Array
(
[0] => /7/0/702-100_thumb-sm_1.jpg
[thumbnail] => /7/0/702-100_thumb-sm_1.jpg
[storename] => Slovenly Europe
)
[3] => Array
(
[0] => /7/0/702-100_thumb-sm_1.jpg
[thumbnail] => /7/0/702-100_thumb-sm_1.jpg
[storename] => Greece
)
[4] => Array
(
[0] => /7/0/702-100_thumb-sm_1.jpg
[thumbnail] => /7/0/702-100_thumb-sm_1.jpg
[storename] => Greece
)
[5] => Array
(
[0] => /7/0/702-100_thumb-sm_1.jpg
[thumbnail] => /7/0/702-100_thumb-sm_1.jpg
[storename] => Greece
)