PHP code example of knot / knot

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

    

knot / knot example snippets


$obj = ar(1,2,3);

$obj->merge(array(3,3,4,5,6,7))->unique();

$obj->child = array("a", "b", "c");

$array = $obj->toArray();

$obj = ar();

$obj["new"]["way"] = "new way value";

$obj[][][][] = 1;

$obj = ar();

$obj->new = array(
    "way" => "new value"
);

// Returns array("way" => "new value")
$obj->new->toArray();

$obj = ar();

$obj->new->way->foo = 1;

$obj = arr(array(
    "foo" => array(
        "sub" => array(
            "target" => 123
        )
    )
));

// Returns $obj["foo"]["sub"]["target"]
$target = $obj->get("foo.sub.target");
array_unique