Skip to content

Instantly share code, notes, and snippets.

@DarkSmith
Created July 2, 2012 15:46
Show Gist options
  • Save DarkSmith/3033877 to your computer and use it in GitHub Desktop.
Save DarkSmith/3033877 to your computer and use it in GitHub Desktop.
access to object with dot notation string
$data = array('parent' => array('child' => 'hello world'));
$filter = new DotNotationFilter($data); // $data is an object or an array
$hello = $filter->get('parent.child'); // eq to $data['parent'][’child'] or $data->parent->child;
$hello == 'hello world';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment