I have two arrays as follows:
$cmobine = array (
[0] => Array
(
[0] => KAWAT LOKET 1/2 HIJAU 10M
[1] => KAWAT LOKET 1/4 HIJAU 10M
)
[1] => Array
(
[0] => KAWAT LOKET 1/2 HIJAU 10M
[1] => KUAS ETERNA 4"
)
[2] => Array
(
[0] => KAWAT LOKET 1/2 HIJAU 10M
[1] => SIKU LUBANG
)
[3] => Array
(
[0] => SIKU LUBANG
[1] => KUAS ETERNA 4"
)
)
And a second array:
$transaction = array (
[003352] => Array
(
[0] => KAWAT LOKET 1/2 HIJAU 10M
[1] => KAWAT LOKET 1/4 HIJAU 10M
)
[003353] => Array
(
[0] => BODI LIDAH PELOR SS 2036-402 SES
[1] => KAWAT LOKET 1/2 HIJAU 10M
[2] => SIKU LUBANG
)
[003363] => Array
(
[0] => ENGSEL TIPIS BRAS 2 + SKRUP
[1] => ENGSEL TIPIS BRAS 2 1/2 + SKRUP
[2] => KUAS ETERNA 4"
[3] => LAMSKAR SN
[4] => MASKER HIDUNG
[5] => OBENG BB ANOVI
[6] => PAKU BETON 30
[7] => PAKU BETON HITAM 50
[8] => SIKU LUBANG
[9] => PAKU BETON PUTIH 5
[10] => SARINGAN GOT STAINLIS NISHIO
)
[003366] => Array
(
[0] => GRENDEL BABET GP 2" GOMEO
[1] => GRENDEL STANLIS IMPERIAL 2"
)
);
then produces an array like this in accordance with the comparison array:
$result = array (
[0] => Array
(
[0] => KAWAT LOKET 1/2 HIJAU 10M
[1] => KAWAT LOKET 1/4 HIJAU 10M
)
[1] => Array
(
[0] => KAWAT LOKET 1/2 HIJAU 10M
[1] => SIKU LUBANG
)
[2] => Array
(
[0] => SIKU LUBANG
[1] => KUAS ETERNA 4"
)
);
$ombine
value of compared with $transaction
value and if there is a match, then the result is the value of $combine
itself.
according to the $results
above.
Using array_diff_assoc() may help in this case.