PHP code example of oleku / supervariable

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

    

oleku / supervariable example snippets


$array = array(
		"foo" => "bar",
		array(
				"name" => "super"
		)
);

// Start super Variable
$array = new Varriable($array);
// Array
echo $array['foo'] ; // returns bar
// Invoke
echo $array("foo"); // returns bar
// Object
echo $array->foo ; // returns bar
// Method
echo $array->foo() ; // returns bar
// Via Offset
echo $array->offsetGet("hello");// returns bar


// Modification is Disabled by default
// Get via offsetGet
array["hello"] = "World" // throws Exception

// Can can also find for sub arrays or Object
echo $array->find("foo.name"); // returns Super