I am in a situation to make an array unique by the subarray index.Please refer this code and help me to solve this.
$user=Array(
[1]=>Array(
username => Sujith,
email=>someone@example.com,
[address] => Array(
[address_id] => 1227
[city] => Ayoor
[state] => Kerala
[Country] => India
)
)
[2]=>Array(
username => Ajith,
email=>someone2@example.com,
[address] => Array(
[address_id] => 1227
[city] => Ayoor
[state] => Kerala
[Country] => India
)
)
[3]=>Array(
username => Akhil,
email=>someone3@example.com,
[address] => Array(
[address_id] => 1228
[city] => Kollam
[state] => Kerala
[Country] => India
)
)
)
I want to make it unique by the address.address_id.So the resulting array should be
$user=Array(
[1]=>Array(
username => Sujith,
email=>someone@example.com,
[address] => Array(
[address_id] => 1227
[city] => Ayoor
[state] => Kerala
[Country] => India
)
)
[3]=>Array(
username => Akhil,
email=>someone3@example.com,
[address] => Array(
[address_id] => 1228
[city] => Kollam
[state] => Kerala
[Country] => India
)
)
)
I mean ,1 user per address..Please help me to solve this..