1. Go to this page and download the library: Download heliomarpm/linq-php 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/ */
// Ordena por uma chave simples
$result = LinqPHP::from($data)
->orderByKey('age', 'desc')
->toArray();
// Ordenação múltipla
$result = LinqPHP::from($data)
->orderBy(['name' => 'asc', 'age' => 'desc'])
->toArray();
$linq = LinqPHP::from($data)->where(['age', '>', 20]);
// Retorna um array tradicional
$array =$linq->toArray();
// Retorna um stdClass contendo metadados de performance
$obj =$linq->toObject();
echo $obj->count; // Quantidade de registros
echo $obj->elapsedTime; // Tempo de execução
echo $obj->memoryUsed; // Memória gasta
print_r($obj->rows); // Os dados em si
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.