Skip to content

Commit

Permalink
Add documentation for undocumented isAssoc method
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewFeeney authored Nov 21, 2019
1 parent 32d0e2f commit df97a21
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Laravel includes a variety of global "helper" PHP functions. Many of these funct
[Arr::forget](#method-array-forget)
[Arr::get](#method-array-get)
[Arr::has](#method-array-has)
[Arr::isAssoc](#method-array-isassoc)
[Arr::last](#method-array-last)
[Arr::only](#method-array-only)
[Arr::pluck](#method-array-pluck)
Expand Down Expand Up @@ -346,6 +347,25 @@ The `Arr::has` method checks whether a given item or items exists in an array us
$contains = Arr::has($array, ['product.price', 'product.discount']);

// false

<a name="method-array-isassoc"></a>
#### `Arr::isAssoc()` {#collection-method}

The `Arr::isAssoc` returns `true` if the given array is an associative array.

An array is "associative" if it doesn't have sequential numerical keys beginning with zero.

use Illuminate\Support\Arr;

$array = ;

$isAssoc = Arr::isAssoc(['product' => ['name' => 'Desk', 'price' => 100]]);

// true

$isAssoc = Arr::isAssoc([1, 2, 3]);

// false

<a name="method-array-last"></a>
#### `Arr::last()` {#collection-method}
Expand Down

0 comments on commit df97a21

Please sign in to comment.