a::missing($array, $required = array())

Checks for missing elements in an array

  • $array (array)
    The source array
  • $required (array)
    An array of required keys
  • return (array)
    An array of missing fields. If this is empty, nothing is missing.

Example

<?php
$array = array(
  'cat' => 'miao',
  'dog' => 'wuff',
  'bird' => 'tweet'
);

$required = array('cat', 'elephant');

$missing = a::missing($array, $required);
// missing: array(
//   'elephant'
// );