Skip to content

Commit

Permalink
Default value.
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Sep 8, 2014
1 parent b97bbea commit ab97465
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,12 @@ The `array_forget` method will remove a given key / value pair from a deeply nes
### array_get

The `array_get` method will retrieve a given value from a deeply nested array using "dot" notation.
As a third parameter you may specify a custom default value.

$array = array('names' => array('joe' => array('programmer')));

$value = array_get($array, 'names.joe');
$value = array_get($array, 'names.john', null);

$value = array_get($array, 'names.john', 'default');

> **Note:** Want something like `array_get` but for objects instead? Use `object_get`.
Expand Down

0 comments on commit ab97465

Please sign in to comment.