Method: a::missing
Checks for missing elements in an array
This is very handy to check for missing
user values in a request for example.
Info
Syntax
a::missing($array, $required=array())
Parameters
- $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
$array = array(
'cat' => 'miao',
'dog' => 'wuff',
'bird' => 'tweet'
);
$required = array('cat', 'elephant');
$missng = a::missing($array, $required);
// missing: array(
// 'elephant'
// );