use QueryArray\QueryArray; $fruits = ['apple', 'banana', 'orange', 'grape', 'mango']; $queryArray = new QueryArray($fruits); $filtered = $queryArray->where('value', 'banana')->toArray(); print_r($filtered); // Output: // Array( // [1] => banana // )
use QueryArray\QueryArray; $students = [ ['name' => 'John', 'score' => 80], ['name' => 'Jane', 'score' => 70], ['name' => 'Jack', 'score' => 90], ['name' => 'Jill', 'score' => 80] ]; $queryArray = new QueryArray($students); $grouped = $queryArray->groupBy('score')->toArray(); print_r($grouped); // Output: // Array( // [80] => Array( // [0] => Array( // [name] => John, // [score] => 80 // ), // [1] => Array( // [name] => Jill, // [score] => 80 // ) // ), // [70] => Array( // [0] => Array( // [name] => Jane, // [score] => 70 // ) // ), // [90] => Array( // [0] => Array( // [name] => Jack, // [score] => 90 // ) // ) // )Based on the examples provided, it can be determined that QueryArray is a package library developed specifically for filtering, sorting and grouping of arrays in PHP.