私は約250人の従業員の配列を持っています。私は彼らの配列の1つまたは2つの要素が異なるほとんどの従業員の重複を持っています。同じ "empNum"を持つ配列を検出して組み合わせるにはどうしたらいいですか?以下の例は、私が133個の要素を組み合わせた例です。 1は、上記から配列および他の配列に明確なempNumsを得るために:私は試してみました何どのように自分自身に配列を結合するのですか
Array
(
[0] => Array
(
[empNum] => 17
[wksWrkd] => 2
[trcode] => 1
[appn] => 51000550000
[totalHours] => 20.00
[rate] => 12.00
[net] => 240.00
[overHours] => .00
[holidayHours] => .00
[overtimePay] => .00
[otherPay] => .00
[holidayPay] => .00
[ctu] => .00
[cta] => .00
[ptu] => .00
[pta] => .00
[sickHours] => .0000
[vacaHours] => .0000
[gross] => 240.00
)
[1] => Array
(
[empNum] => 17
[wksWrkd] => 2
[trcode] => 1
[appn] => 20000560000
[totalHours] => 34.00
[rate] => 12.00
[net] => 408.00
[overHours] => .00
[holidayHours] => .00
[overtimePay] => .00
[otherPay] => .00
[holidayPay] => .00
[ctu] => .00
[cta] => .00
[ptu] => .00
[pta] => .00
[sickHours] => .0000
[vacaHours] => .0000
[gross] => 408.00
)
[2] => Array
(
[empNum] => 17
[wksWrkd] => 2
[trcode] => 1
[appn] => 51000550005
[totalHours] => 54.00
[rate] => 12.00
[net] => 648.00
[overHours] => .00
[holidayHours] => .00
[overtimePay] => .00
[otherPay] => .00
[holidayPay] => .00
[ctu] => .00
[cta] => .00
[ptu] => .00
[pta] => .00
[sickHours] => .0000
[vacaHours] => .0000
[gross] => 648.00
)
[3] => Array
(
[empNum] => 17
[wksWrkd] => 2
[trcode] => 1
[appn] => 20000560005
[totalHours] => 13.00
[rate] => 12.00
[net] => 156.00
[overHours] => .00
[holidayHours] => .00
[overtimePay] => .00
[otherPay] => .00
[holidayPay] => .00
[ctu] => .00
[cta] => .00
[ptu] => .00
[pta] => .00
[sickHours] => .0000
[vacaHours] => .0000
[gross] => 156.00
)
[4] => Array
(
[empNum] => 17
[wksWrkd] => 2
[trcode] => 4
[appn] => 51000550000
[totalHours] => .00
[rate] => .00
[net] => .00
[overHours] => 4.00
[holidayHours] => 72.00
[overtimePay] => .00
[otherPay] => .00
[holidayPay] => .00
[ctu] => .00
[cta] => .00
[ptu] => .00
[pta] => .00
[sickHours] => .0000
[vacaHours] => .0000
[gross] => 72.00
)
[5] => Array
(
[empNum] => 17
[wksWrkd] => 2
[trcode] => 4
[appn] => 51000550005
[totalHours] => .00
[rate] => .00
[net] => .00
[overHours] => .25
[holidayHours] => 4.50
[overtimePay] => .00
[otherPay] => .00
[holidayPay] => .00
[ctu] => .00
[cta] => .00
[ptu] => .00
[pta] => .00
[sickHours] => .0000
[vacaHours] => .0000
[gross] => 4.50
)
[6] => Array
(
[empNum] => 17
[wksWrkd] => 2
[trcode] => 4
[appn] => 20000560005
[totalHours] => .00
[rate] => .00
[net] => .00
[overHours] => .25
[holidayHours] => 4.50
[overtimePay] => .00
[otherPay] => .00
[holidayPay] => .00
[ctu] => .00
[cta] => .00
[ptu] => .00
[pta] => .00
[sickHours] => .0000
[vacaHours] => .0000
[gross] => 4.50
)
)
は、2つのクエリです。私は2つのforeachをしましたが、要素をそれ自身と比較し、要素が変更されると次の要素に移動する方法はわかりません。私はarray_merge()とarray_merge_recursive()も試みました。
DId自分で何かを試してみましたか?それが何だった?ここでそれを共有してください。 –
[値に基づいてユニークな多次元配列(配列キーではない)]の可能な複製(http://stackoverflow.com/questions/6057151/multidimensional-array-unique-based-onvalue-not-array-key) – Midas
Iそのコードを試しました。私は何かを取り除きたいとは思わない。私は重複を保ちたい。 – moe