Checks whether or not the supplied array is a struct or not
Parameters
$array
arrayrequired
Source
function isStruct($array)
{
$expected = 0;
foreach ($array as $key => $value) {
if ((string)$key !== (string)$expected) {
return true;
}
$expected++;
}
return false;
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.