PHP code example of colindev / php-object-chain

1. Go to this page and download the library: Download colindev/php-object-chain 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/ */

    

colindev / php-object-chain example snippets



use Colin\ObjectChain;

$data = new ObjectChain(json_decode('{"key":"hello","vary":{"depth":{"key":"found"}}}'));

$data->{'key'}->value();// return 'hello'
$data['key']->value();// return 'hello'

$data['vary']['depth']['key']->value();// return 'found'
$data['vary']['depth']['depth']['key']->value();// return null