Skip to content

Instantly share code, notes, and snippets.

@neatstudio
Last active June 30, 2017 00:41
Show Gist options
  • Save neatstudio/6601f22a214592579aa3 to your computer and use it in GitHub Desktop.
Save neatstudio/6601f22a214592579aa3 to your computer and use it in GitHub Desktop.
php : in array
<?php
$array = array(
1 => array('n' => 'a1', 'p' => 1, 't' => 'a', 'bk' => array('2'), 'cd' => 2),
2 => array('n' => 'a2', 'p' => 2, 't' => 'a', 'ak' => array('3', '4'), 'cd' => 1),
3 => array('n' => 'a3', 'p' => 3, 't' => 'a', 'cd' => 1),
);
$ret = in_array(false, array_map(function ($item) {
return $item['cd'] ? true :false;
}, $array));
var_dump($ret);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment