Created
August 26, 2012 20:56
-
-
Save MZAWeb/3483555 to your computer and use it in GitHub Desktop.
array_intersect_assoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_array_compare( $val1, $val2 ) { | |
return ( $val1["parent_entry_id"] == $val2["parent_entry_id"] ); | |
} | |
$first = array( array( "parent_entry_id" => 123 ), array( "parent_entry_id" => 987 ), ); | |
$second = array( array( "parent_entry_id" => 123 ), | |
array( "parent_entry_id" => 321 ), | |
array( "parent_entry_id" => 789 ), | |
array( "parent_entry_id" => 987 ), ); | |
$third = array_uintersect( $first, $second, 'my_array_compare' ); | |
var_dump( $third ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment