- var_dump: documentation ( source)
- is_numeric: documentation ( source)
- in_array: documentation ( source)
<?php
$data = ['staffId' => '1111', 'password' => 'aaaa'];
function data_foreach($data) {
foreach($data as $key => $val) {
$d[$key] = $val;
if($d[$key] === '') {
$boolVal[] = FALSE;
} else {
if(!is_numeric($d[$key])) {
$boolVal[] = FALSE;
} else {
$boolVal[] = TRUE;
}
}
}
return (in_array(FALSE, $boolVal, true)) ? FALSE : TRUE;
}
var_dump(data_foreach($data));