dev-master
9999999-dev https://github.com/mKomorowski/php-dot-getArray dot notation access
MIT
The Requires
- php >=5.3
The Development Requires
by Michal Komorowski
dot php array access notation get
Wallogit.com
2017 © Pedro Peláez
Array dot notation access
Array dot notation access, (*1)
The package can be installed via Composer by adding to the composer.json require block., (*2)
{
"require": {
"mkomorowski/php-dot-get": "dev-master"
}
}
Then update application packages by running the command:, (*3)
php composer.phar install
$dot = new mKomorowski\Notation\Dot;
Get value from array, (*4)
$array = array(
'name' => 'Name',
'firstname' => 'FirstName',
'address' => array(
'street' => '',
'city' => 'Leeds'
)
);
$dot->get($array, 'address.city'); // 'Leeds'
Tell if the value isset in array, (*5)
$dot->exists($array, 'address.city'); // true
Set default value returned if given key is not found in array, (*6)
$dot->get($array, 'address.country') // null
$dot->setDefault('undefined');
$dot->get($array, 'address.country') // 'undefined'
Compare requested value with given one, (*7)
$dot->assert($array, 'name', 'Name') // true
Array dot notation access
MIT
dot php array access notation get