这是我正在处理的数组的示例:
Array
(
[0] => Array
(
[id] => 1331
[shortname] => MCS-115-113C
[userid] => 663
[email] => asdfasfd@asdfasfd.br
[username] => FOOBARBAZ
[nombrecompleto] => asdfasdf
[lastlogin] => 1367501486
)
[1] => Array
(
[id] => 1331
[shortname] => MAFA-EOOF
[userid] => 323
[email] => asdfasfd@asdfasfd.br
[username] => FOOBARBAZ
[nombrecompleto] => asdfasdf
[lastlogin] => 136732186
)
[2] => Array
(
[id] => 1331
[shortname] => MKT-FOOBAR
[userid] => 434
[email] => asdfasfd@asdfasfd.br
[username] => adsfasdf
[nombrecompleto] => asdfasdf
[lastlogin] => 1367234486
)
就我而言,我想比较username
数组中的元素并删除重复项。
所以在这种情况下,我只会返回两个元素,用户名FOOBARBAZ
和adsfasdf
:
Array
(
[0] => Array
(
[id] => 1331
[shortname] => MAFA-EOOF
[userid] => 323
[email] => asdfasfd@asdfasfd.br
[username] => FOOBARBAZ
[nombrecompleto] => asdfasdf
[lastlogin] => 136732186
)
[1] => Array
(
[id] => 1331
[shortname] => MKT-FOOBAR
[userid] => 434
[email] => asdfasfd@asdfasfd.br
[username] => adsfasdf
[nombrecompleto] => asdfasdf
[lastlogin] => 1367234486
)
我怎样才能在 PHP 中做到这一点?