Created
February 6, 2018 18:59
-
-
Save xikaos/b31850694aa4424813b93a0e768d339f to your computer and use it in GitHub Desktop.
Shitty ".select" ruby method analog.
This file contains hidden or 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
function filter_by_value ($array, $index, $value){ | |
if(is_array($array) && count($array)>0) | |
{ | |
foreach(array_keys($array) as $key){ | |
$temp[$key] = $array[$key][$index]; | |
if ($temp[$key] == $value){ | |
$newarray[$key] = $array[$key]; | |
} | |
} | |
} | |
return $newarray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment