PHP code example of jimphle / data-structure

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

    

jimphle / data-structure example snippets


$vector = new \Jimphle\DataStructure\Vector(
    array(
        'foo',
        'bar'
    )
);

echo $vector[1];

$map = new \Jimphle\DataStructure\Map(
    array(
        'foo' => 'bar'
    )
);
echo $map->foo;

$map = new \Jimphle\DataStructure\Map(
    array(
        'foo-1' => 'bar'
    )
);
echo $map['foo-1'];

$map = new \Jimphle\DataStructure\Map(
    array(
        'who?' => new \Jimphle\DataStructure\Vector(
            array(
                new Jimphle\DataStructure\Map(
                    array(
                        'foo' => 'bar'
                    )
                )
            )
        )
    )
);
echo $map->toJson();