PHP code example of kumatch / farray

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

    

kumatch / farray example snippets



use Kumatch\Farray\Farray

$list = new Farray(array(10, 20)); // Farray extends ArrayObject

$a = $list[0];   // $a = 10
$b = $list[1];   // $b = 20

isset($list[2]);   // false
$c = $list[2];     // $c = null, and does not raise "undefined index".


// farray creates recursively.
$list = new Farray(array("foo" => 10, "bar" => array(20)));

$foo = $list["foo"];     // 10
$bar = $list["bar"];     // farray instance