I have some idea from the previous posts that were talking about making a hash value for each $arr[$i]
, and then compare the hash to get the unique array, but I don't know what I can do exactly.
My sample array Data:
$arr = [
[0, 1, 2, 3],
[4, 5, 2, 1],
[0, 0, 0, 0],
[0, 1, 2, 3]
];
I expected to return:
[
[0, 1, 2, 3],
[4, 5, 2, 1],
[0, 0, 0, 0]
]
Quick and simple:
$arr = array_map('unserialize', array_unique(array_map('serialize', $arr)));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With