Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は2つの配列を持っています
$arr1 = array(1,3); $arr2 = array(2,4);
それらを構造を持つ1つの配列にマージしたい:
$arr = array(1,2,3,4);
そのためのphp関数がありますか、それとも良い解決策がありますか? UPD: 並べ替え値は必要ありません。最初の配列の要素を奇数の位置に配置し、2 番目の要素を偶数の位置に配置したい
いいえ。PHP には、私が知っているこの機能はありません。自分で書く必要がありますが、とても簡単です。
擬似コード:
cmb = [] for (i=0, i<arr1.length, i++) { array_push(cmb, arr1[i]); array_push(cmb, arr2[i]); }