Skip to content

Instantly share code, notes, and snippets.

@tlkshadow
Created January 5, 2020 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlkshadow/1e8ef15d5bc18ba146aafb1f169771d1 to your computer and use it in GitHub Desktop.
Save tlkshadow/1e8ef15d5bc18ba146aafb1f169771d1 to your computer and use it in GitHub Desktop.
<?php
$aCity = new \stdClass();
$aCity->name = 'Hamburg';
$object = new \stdClass();
$object->name = 'Marcel';
$object->cities = [$aCity];
echo data_get($object, 'name');
echo data_get($object, 'not', ' is from ');
echo data_get($object, 'cities.0.name');
## Output: Marcel is from Hamburg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment