- var_dump: documentation ( source)
- asort: documentation ( source)
- array_diff: documentation ( source)
- set_error_handler: documentation ( source)
- header: documentation ( source)
<?php
header('Content-Type: text/plain');
function errorHandler($errno, $errstr, $errfile, $errline) {
if ($errno === E_RECOVERABLE_ERROR) {
$foo = [];
asort($foo);
echo $errstr . PHP_EOL;
return true;
}
return false;
}
set_error_handler('errorHandler');
$key = [
(int) 0 => 'foo'
];
$select = [
'id' => new stdClass(),
'foo' => 'foo',
'bar' => 'bar'
];
$missingFields = array_diff($key, $select) !== [];
var_dump($missingFields);