fork download
  1. <?php
  2.  
  3. $users = [
  4. [
  5. 'first_name' => [
  6. 'john',
  7. ],
  8. 'is_activated' => [
  9. 0
  10. ],
  11. ],
  12. [
  13. 'first_name' => [
  14. 'mark',
  15. ],
  16. 'is_activated' => [
  17. 1
  18. ],
  19. ],
  20. [
  21. 'first_name' => [
  22. 'pretik',
  23. ],
  24. 'is_activated' => [
  25. 0
  26. ],
  27. ],
  28. ];
  29.  
  30. $activated = array_filter($users, function($record) {
  31. return reset($record['is_activated']) == 1;
  32. });
  33.  
  34. echo count($activated) ? 'yes' : 'no';
  35.  
  36. // The activated users
  37. echo PHP_EOL . PHP_EOL;
  38. print_r($activated);
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
yes

Array
(
    [1] => Array
        (
            [first_name] => Array
                (
                    [0] => mark
                )

            [is_activated] => Array
                (
                    [0] => 1
                )

        )

)