function search($needles, $haystack) {
  $found = [];
  array_walk_recursive($haystack, function($item, $key) use ($needles, &$found) {
    if (in_array($key, $needles) && !in_array($key, $found))
      $found[] = $key;
  });
 return (count(array_diff($needles, $found)) == 0);
}
print search(['foo', 'bar'], $a) ? 'true' : 'false';$request = $pdo->prepare("SELECT `id`, `name` FROM `fruits` ORDER BY `name`");
$request->execute();
$data = [];
$prevLetter = '';
$subArray = [];
foreach ($row = $request->fetch(PDO::FETCH_ASSOC)) {
  $firstLetter = mb_substr($row['name'], 0, 1);
  if ($prevLetter != $firstLetter) {
    if (count($subArray) > 0)
      $data[] = $subArray;
    $subArray = [];
    $prevLetter = $firstLetter;
  }
  $subArray[] = $row;
}
if (count($subArray) > 0)
  $data[] = $subArray;[callback]
exten => _X.,1,Answer()
same => n,Playback(всё, что хотите сказать менеджеру)
same => n,Dial(канал/${EXTEN})