Created
April 1, 2017 17:20
-
-
Save rambabusaravanan/c362e1777ac5584bb4c6a3c953cc58ac to your computer and use it in GitHub Desktop.
PHP Utility Functions - Arrays
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 array_table_innerjoin(Array $leftArr, Array $rightArr, String $key) { | |
$mergeArray = []; | |
foreach($leftArr as $leftRow) { | |
foreach($rightArr as $rightRow) { | |
if(isset($leftRow[$key]) && isset($rightRow[$key]) && $leftRow[$key] == $rightRow[$key]) { | |
$mergeArray[] = array_merge($leftRow, $rightRow); | |
} | |
} | |
} | |
return $mergeArray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment