私はこのように2つの配列を持っています。 ARRAY1:PHPで2つの異なる配列を使って新しい配列を作成する
Array
(
[abu-garcia] => 1
[daiwa] => 4
[shimano] => 4
)
Array 2:
Array
(
[0] => Array
(
[brand_id] => 36
[brand_name] => Abu Garcia
[brand_slug] => abu-garcia
)
[1] => Array
(
[brand_id] => 41
[brand_name] => Daiwa
[brand_slug] => daiwa
)
[2] => Array
(
[brand_id] => 41
[brand_name] => Daiwa
[brand_slug] => daiwa
)
[3] => Array
(
[brand_id] => 41
[brand_name] => Daiwa
[brand_slug] => daiwa
)
[4] => Array
(
[brand_id] => 41
[brand_name] => Daiwa
[brand_slug] => daiwa
)
[5] => Array
(
[brand_id] => 39
[brand_name] => Shimano
[brand_slug] => shimano
)
[6] => Array
(
[brand_id] => 39
[brand_name] => Shimano
[brand_slug] => shimano
)
[7] => Array
(
[brand_id] => 39
[brand_name] => Shimano
[brand_slug] => shimano
)
私は次のようになります。新しい配列を作成します:
Array
(
[0] => Array
(
[brand_id] => 36
[brand_name] => Abu Garcia
[brand_slug] => abu-garcia
[count] => 1
)
[1] => Array
(
[brand_id] => 41
[brand_name] => Daiwa
[brand_slug] => daiwa
[count] => 4
)
[2] => Array
(
[brand_id] => 41
[brand_name] => Daiwa
[brand_slug] => daiwa
[count] => 4
)
[3] => Array
(
[brand_id] => 41
[brand_name] => Daiwa
[brand_slug] => daiwa
[count] => 4
)
[4] => Array
(
[brand_id] => 41
[brand_name] => Daiwa
[brand_slug] => daiwa
[count] => 4
)
[5] => Array
(
[brand_id] => 39
[brand_name] => Shimano
[brand_slug] => shimano
[count] => 4
)
[6] => Array
(
[brand_id] => 39
[brand_name] => Shimano
[brand_slug] => shimano
[count] => 4
)
[7] => Array
(
[brand_id] => 39
[brand_name] => Shimano
[brand_slug] => shimano
[count] => 4
)
を両配列はワードプレスによってそこに作成されます。 array1は関数の出力であり、ブランドの中にある商品の数をチェックすると、他の配列はブランドの詳細を与えています。 おかげ
あなたは(array_mergeを試してみました) –