PHP code example of rezouce / selector
1. Go to this page and download the library: Download rezouce/selector 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/ */
rezouce / selector example snippets
use Selector\Selector;
use Selector\Parser\ArrayParser;
$data = [
'users' => [
'name' => 'Steve',
'age' => 49,
],
[
'name' => 'Edward',
'age' => 34,
],
];
$selector = new Selector($data, new ArrayParser);
$selector->get('users.name'); // return ['Steve', 'Edward']
$selector->get('users[1].name'); // return 'Edward'