codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php $arrNames = array( array('first'=>'John', 'last'=>'Smith', id=>'1'), array('first'=>'John', 'last'=>'Smith', id=>'2'), array('first'=>'John', 'last'=>'Smith', id=>'3') ); $arrFound = array(); foreach ($arrNames as $k => $arrPerson) { $arrPersonNoId = array( 'first' => $arrPerson['first'], 'last' => $arrPerson['last'] ); if (in_array($arrPersonNoId, $arrFound)) { unset($arrNames[$k]); } else { $arrFound[] = $arrPersonNoId; } } print_r($arrNames);
Private
[
?
]
Run code
Submit