-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.php
44 lines (38 loc) · 886 Bytes
/
example.php
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
require_once 'vendor/autoload.php';
use Ruhul\ArrayQuery\ArrayQ;
$array = [
[
'id' => 1,
'name' => 'John Doe',
'email' => '[email protected]',
'age' => 25,
'dob' => '1999-05-15',
'company' => "PQR Enterprises"
],
[
'id' => 2,
'name' => 'Jane Smith',
'email' => '[email protected]',
'age' => 30,
'dob' => '1994-08-20',
'company' => "PQR Enterprises"
],
[
'id' => 3,
'name' => 'Alice Johnson',
'email' => '[email protected]',
'age' => 35,
'dob' => '1989-12-10',
'company' => "PQR Enterprises"
]
];
try {
$result = ArrayQ::from($array)
->select('id', 'name')
->orderBy('name', 'asc')
->get();
} catch (\Exception $e) {
$result = $e->getMessage();
}
pr($result);