PHP code example of floor9design / search-string-parser
1. Go to this page and download the library: Download floor9design/search-string-parser 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/ */
floor9design / search-string-parser example snippets
php
// Instantiate
$ssp = new SearchStringParser(new ParserSimple);
// run a search:
$string = 'some search terms "including literals enclosed in quotes"';
$array = $ssp->parse($string);
php
// Instantiate
$ssp = new SearchStringParser(new ParserSimple);
// run a search:
$string = 'some "search terms" Pincluding literals enclosed in another letterP';
$array = $ssp->parse($string);
php
array(
0 => 'including literals enclosed in another letter',
1 => 'some',
2 => '"search',
3 => 'terms"'
);
php
// we are in the middle of the code, and the object has already been instantiated as above:
$string = 'some input text "including literals enclosed in quotes"';
$array = $ssp->parse($string);
// ... I'll now skip to the relevant part of zend - I assume you can write a query:
foreach($array as $keyword) {
$select->orWhere('data_table LIKE ?', "%$keyword%")
}