1. Go to this page and download the library: Download penobit/linq library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
penobit / linq example snippets
use Penobit\Linq\Linq;
$linq = new Linq($data);
$linq->collect(['id'=>1, 'name'=>'Penobit']);
linq($data);
use Penobit\JsonQ\Linq;
$q = new Linq($data);
$res = $q->from('products')
->where('cat', '=', 2)
->get('name', 'price');
// or you could use $q->select('name', 'price') or $q->fetch('name', 'price') instead of getch
var_dump($res->toArray());
//This will print
/*
array:3 [▼
1 => {#7 ▼
+"name": "macbook pro"
+"price": 150000
}
4 => {#8 ▼
+"name": "macbook air"
+"price": 110000
}
5 => {#9 ▼
+"name": "macbook air 1"
+"price": 81000
}
]
*/