i need help about how to remove one or more array child from set of array that have exactly same keys and values with other child in PHP. Please take a look this array:
Array
(
[0] => Array
(
[scn_fr_tm] => 10:35
[scn_to_tm] => 12:55
[mov_prnt_nm] => Thor Ragnarok
)
[1] => Array
(
[scn_fr_tm] => 10:40
[scn_to_tm] => 12:39
[mov_prnt_nm] => Geostorm
)
[2] => Array
(
[scn_fr_tm] => 11:30
[scn_to_tm] => 13:22
[mov_prnt_nm] => One Fine Day
)
[3] => Array
(
[scn_fr_tm] => 11:30
[scn_to_tm] => 13:22
[mov_prnt_nm] => One Fine Day
)
[4] => Array
(
[scn_fr_tm] => 11:30
[scn_to_tm] => 13:00
[mov_prnt_nm] => Total Chaos
)
[5] => Array
(
[scn_fr_tm] => 11:30
[scn_to_tm] => 13:22
[mov_prnt_nm] => One Fine Day
)
)
as you can see from above array, i want to remove array[3] and array[5] from array because it has duplicate keys and values with array[2]. Above array created dynamically, so please don't ask me to use unset(array[3]) and unset(array[5]).
here is my array creation code, the array created from other array:
foreach ($datas as $data)
{
if (array_key_exists('attr', $data))
{
$arr[] = array(
'scn_fr_tm' => substr_replace($data['attr'][0]['scn_fr_tm'],':',2,0),
'scn_to_tm' => substr_replace($data['attr'][0]['scn_to_tm'],':',2,0),
'mov_prnt_nm' => substr($data['mov_prnt_nm'], 0, 20)
);
}
}
Thank you for your help