PHP Classes
elePHPant
Icontem

File: examples/find.php

Recommend this page to a friend!
  Classes of Nahid Bin Azhar  >  PHP JSON Query  >  examples/find.php  >  Download  
File: examples/find.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:
Date: 8 months ago
Size: 529 bytes
 

Contents

Class file image Download
<?php
/**
 * Example: find($node)
 * ======================
 *
 * To find your desire data from specific path
 * you can use this method. This method used as direct array or object accessor
 */

require_once '../vendor/autoload.php';

use
Nahid\JsonQ\Jsonq;

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

try {
   
$res = $q->find('vendor.name');
   
dump($res);
} catch (\
Nahid\JsonQ\Exceptions\ConditionNotAllowedException $e) {
    echo
$e->getMessage();
} catch (\
Nahid\JsonQ\Exceptions\NullValueException $e) {
    echo
$e->getMessage();
}