Skip to content

Instantly share code, notes, and snippets.

@fxcosta
Created February 6, 2020 22:43
Show Gist options
  • Save fxcosta/52ba0c454b2204f06b5931255e6edb11 to your computer and use it in GitHub Desktop.
Save fxcosta/52ba0c454b2204f06b5931255e6edb11 to your computer and use it in GitHub Desktop.
<?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