Answers for "php recognize associative array vs indexed array"

PHP
1

php check array is not associative

count(array_filter(array_keys($array), 'is_string')) === 0
Posted by: Guest on September-03-2020
0

check array is associative laravel

// true
$isAssoc = Arr::isAssoc([
    'associative' => 'array'
]);

// false
$isAssoc = Arr::isAssoc([
    0 => 'A',
    1 => 'B',
    2 => 'C'
]);
Posted by: Guest on October-22-2020

Code answers related to "php recognize associative array vs indexed array"

Browse Popular Code Answers by Language