PHP code example of thoma127 / dict

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

    

thoma127 / dict example snippets


$data = ["foo" => "bar"];
$dict = new \UMN\CEHD\Dict\Dict($data);

$foo = $dict->get("foo"); // will be "bar"
$baz = $dict->get("baz"); // will be null
$json = $dict->toJSON(); // will be {"foo":"bar"} (string)

$array = $dict->toArray();

var_dump($array);

array(1) {
  'foo' =>
  string(3) "bar"
}