PHP code example of phoenix-robotix / php-json-toolkit

1. Go to this page and download the library: Download phoenix-robotix/php-json-toolkit 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/ */

    

phoenix-robotix / php-json-toolkit example snippets


$json_toolkit = new PR_JSON_TOOL_KIT();

$json_data = '{
	"a": 1,
	"b": {
		"c": 2,
		"d": 3
	}
}';
$value = $json_toolkit->get_value_of("a", $json_data);  //1
$value = $json_toolkit->get_value_of("e", $json_data);  //false
$value = $json_toolkit->get_value_of("b:c", $json_data);  //2

$value = $json_toolkit->get_data(["c" => 2], ["d"], $json_data);  //[{"d" => 3}]
$value = $json_toolkit->get_data(["c" => 2], [], $json_data); //[{"c" => 2, "d" => 3}]
$value = $json_toolkit->get_data(["c" => 4], [], $json_data); //[]

//JSON Data:
{
	"a": 1,
	"b": {
		"c": 2,
		"d": 3
	}
}