PHP code example of bcismariu / commons-descendable

1. Go to this page and download the library: Download bcismariu/commons-descendable library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bcismariu / commons-descendable example snippets




use Bcismariu\Commons\Descendable\Descendable;

$array = [
    'eyes'  => 'blue',
    'age'   => '27',
    'parents' => [
        'mother'    => 'Jane',
        'father'    => 'Jack'
    ]
];

$descendable = new Descendable($array);

$descendable->get('parents.father', 'John');    // returns 'Jack'
$descendable->get('sister', 'Kate');            // returns 'Kate'
bash
php vendor/bin/phpunit