PHP Classes

File: examples/index.php

Recommend this page to a friend!
  Classes of Nahid Bin Azhar   PHP JSON Query   examples/index.php   Download  
File: examples/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP JSON Query
Query JSON data to find and extract information
Author: By
Last change: Merge pull request #25 from GitHubHubus/conditionTests

Add tests for condition
added quering option in nested data
Merge pull request #22 from GitHubHubus/conditionRefactor

Refactoring condition
Date: 5 years ago
Size: 558 bytes
 

Contents

Class file image Download
<?php

require '../vendor/autoload.php';

use
Nahid\JsonQ\Jsonq;


//$result = '';
//Jsonq::macro('less', function ($payable, $val) {
// return $payable < $val;
//});
//
//Jsonq::macro('int', function ($payable, $val) {
// return is_integer($payable);
//});
//

$jq = new Jsonq('data.json');

try {
   
$result = $jq->from('users')
        ->
where('visits.year', '=', 2010)
        ->
sum('visits.year');
   
dump($result);
} catch (\
Nahid\JsonQ\Exceptions\ConditionNotAllowedException $e) {

} catch (\
Nahid\JsonQ\Exceptions\NullValueException $e) {

}