Created
February 6, 2020 22:43
-
-
Save fxcosta/52ba0c454b2204f06b5931255e6edb11 to your computer and use it in GitHub Desktop.
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
<?php | |
$test = [ | |
[ | |
'role_id' => 1, | |
'name' => 'criar conteúdo' | |
], | |
[ | |
'role_id' => 1, | |
'name' => 'criar enquete' | |
], | |
[ | |
'role_id' => 2, | |
'name' => 'criar enquete' | |
], | |
[ | |
'role_id' => 3, | |
'name' => 'criar enquete' | |
] | |
]; | |
$finder1 = 1; | |
$finder2 = 'criar enquete'; | |
$filtered = array_filter($test, function ($value) use ($finder1, $finder2) { | |
return $value['role_id'] === $finder1 && $value['name'] === $finder2; | |
}); | |
print_r($filtered); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment