Voting

: two plus seven?
(Example: nine)

The Note You're Voting On

jim at akubo dot net
16 years ago
yousef's example was wrong because is_vector returned true instead of false if the key was found
here is the fixed version (only 2 lines differ)
<?php
function is_vector( &$array ) {
if ( !
is_array($array) || empty($array) ) {
return -
1;
}
$next = 0;
foreach (
$array as $k => $v ) {
if (
$k !== $next ) return false;
$next++;
}
return
true;
}
?>

<< Back to user notes page

To Top