Voting

: four plus five?
(Example: nine)

The Note You're Voting On

phpnet at jesseschalken dot com
3 years ago
Polyfills that call `array_keys()`, `array_values()` or `range()` are inefficient because they create new arrays unnecessarily.

Please use this polyfill instead which creates no new arrays and only does a single pass over the given array.

<?php

if (!function_exists("array_is_list")) {
function
array_is_list(array $array): bool
{
$i = 0;
foreach (
$array as $k => $v) {
if (
$k !== $i++) {
return
false;
}
}
return
true;
}
}

?>

<< Back to user notes page

To Top