serhatozles / yii2-arraysearch
此功能在数组内部进行搜索。
dev-master
2016-06-01 23:18 UTC
This package is not auto-updated.
Last update: 2024-09-28 16:51:45 UTC
README
此功能在数组内部进行搜索。参见:https://github.com/serhatozles/ArrayAdvancedSearch
安装
安装此扩展的首选方式是通过composer。
运行以下命令
php composer.phar require --prefer-dist serhatozles/yii2-arraysearch "dev-master"
或将以下内容添加到您的composer.json
文件的require部分:
"serhatozles/yii2-arraysearch": "dev-master"
用法
安装扩展后,只需在代码中使用它即可
$query = "a='Example World' and b>='2'"; $Array = array( 'a' => array('d' => '2'), array('a' => 'Example World','b' => '2'), array('c' => '3'), array('d' => '4'), ); $Result = \serhatozles\arraysearch\ArraySearch::q($Array,$query,1); echo '<pre>'; print_r($Result); echo '</pre>'; // Output: // Array // ( // [0] => Array // ( // [a] => Example World // [b] => 2 // ) // // )