PHP code example of travis / ex

1. Go to this page and download the library: Download travis/ex 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/ */

    

travis / ex example snippets


$array = array(
    'foo' => array(
        'bar' => array(
            'foo' => array(
                'bar' => 'asdf'
            )
        )
    )
);

$value = ex($array, 'foo.bar.foo.bar'); // returns "asdf"
$value = ex($array, 'foo.bar.foo.invalid_key'); // returns null
$value = ex($array, 'foo.bar.foo.invalid_key', 'default'); // returns "default"

$array = null;
$count = excount($array); // returns 0 instead of error