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つの配列があるとしましょう。
array1: value = 2 value = 1 value = 3 array2: value = 1 value = 2 value = 3 value = 4
array1を再配置して、array2と同じ並べ替えを行い、array2にない値を削除したいと思います。array2のソートをフォローしたいのですが、親切に教えていただければ、このための既存の関数があるかどうかわかりません。ありがとうございました。
$array1 = array(2,1,3); $array2 = array(1,2,3,4); $array_intersect = array_intersect($a2, $a1);
$array_intersectその後、次のようになります。
$array_intersect
Array ( [0] => 1 [1] => 2 [2] => 3 )