Skip to content

Instantly share code, notes, and snippets.

@Warbo
Warbo / gist:9d8425fcdd7c026c795a
Last active August 29, 2015 14:01
Array/object lookup function, especially for Drupal
<?php
/**
* Looks up values from deep inside a container (object or array) in a safe way.
* For example:
*
* lookup(
* array('foo' => array('bar' => 'baz')),
* array('foo', 'bar')
* ) === 'baz'