is_numeric_array() is missing
Instead of using a counter to count the keys for which the condition is true, you could just return false as soon as you find a key which is not an int and return true if the loop reaches its end without finding such a key:

foreach ($array as $a =&gt; $b) {
    if (!is_int($a)) {
        return false;
    }
}
return true;


This has the benefit that it short-circuits (i.e. it stops iterating once it finds a key that is not an int) and gets rid of the counter.