method hasProps documentation in bbn\X
Check if an array or an object has the given properties
Example
$arr = [
'a' => 1,
'b' => '',
'c' => 0
];
X::hasProps($arr, ['a', 'b', 'c']);
// (bool) true
X::hasProps($arr, ['a', 'b', 'c'], true);
// (bool) false
* X::hasProps('string', ['a']);
// null
function($obj, array $props, bool $check_empty = false)
{
foreach ($props as $p) {
$test = self::hasProp($obj, $p, $check_empty);
if ($test === null) {
return null;
}
elseif (!$test) {
return false;
}
}
return true;
}
Check if an array or an object has the given properties BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions