fix: check if array is associative or not

This commit is contained in:
Andras Bacsai
2024-09-03 17:04:56 +02:00
parent 8d9a7f0b3c
commit 8150b6fdaf
2 changed files with 41 additions and 14 deletions

View File

@@ -0,0 +1,7 @@
<?php
test('isAssociativeArray', function () {
expect(isAssociativeArray([1, 2, 3]))->toBeFalse();
expect(isAssociativeArray(collect([1, 2, 3])))->toBeFalse();
expect(isAssociativeArray(collect(['a' => 1, 'b' => 2, 'c' => 3])))->toBeTrue();
});