$value = array( '1' );
$value = array( '0' => '1' );
These are the two possible formats of arrays that will be passed to the function below. The first is for lists of items (1, 2, 3...) and second indicates a span (1 - 50). With those values, the function worked fine. But not if the span array is from 0 to X as shown above.
There are countless instances of both array types all over the place. This is the relevant part of the function that handles them
if ( is_array( $value ) )
{
if ( $value[0] || $value[0] === '0' )
{
echo 'item array';
}
else
{
echo 'span array';
}
}
I have tried these answers: How to check if PHP array is associative or sequential?
Which also work where the above function does, but cannot seem to differentiate between the arrays shown above.
This topic explains most of whats going on: A numeric string as array key in PHP
Am I unable to differentiate between the two arrays within the code provided? What am I not getting here?