-
-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathgroup-by.php
More file actions
25 lines (21 loc) · 617 Bytes
/
group-by.php
File metadata and controls
25 lines (21 loc) · 617 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
/**
* Example: groupBy($column = null)
* ================================
*
* groupBy() method helps you to getting grouped data from your
* desire node/path
*/
require_once '../vendor/autoload.php';
use Nahid\JsonQ\Jsonq;
$q = new Jsonq('data.json');
try {
$res = $q->from('users')->groupBy('location')->get();
dump($res);
} catch (\Nahid\JsonQ\Exceptions\ConditionNotAllowedException $e) {
echo $e->getMessage();
} catch (\Nahid\JsonQ\Exceptions\NullValueException $e) {
echo $e->getMessage();
} catch (\Nahid\JsonQ\Exceptions\InvalidNodeException $e) {
echo $e->getMessage();
}