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: Migrate all features from the QArray
Date: 11 days ago
Size: 700 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 {
   
$data = file_get_contents('data.json');
   
// This will remove unwanted characters.
// Check http://www.php.net/chr for details

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

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

}