PHP Classes

String to boolean search string: Convert boolean expression to Google search syntax

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 213 All time: 8,336 This week: 52Up
Version License PHP version Categories
boolean-string 1.0BSD License5PHP 5, Searching, Text processing
Description 

Author

This class can convert boolean expression to Google search syntax.

It takes as parameter a text string that defines an expression that combines text values using AND, OR, NOT and XOR boolean operators.

The class converts the string to represent the same expression using the Google search syntax using quotes, braces, + and - operators.

Picture of Aditya Sarkar
  Performance   Level  
Innovation award
Innovation award
Nominee: 1x

 

Example

<?php
require("class.boolean_string.php");

//echo $sourcestring = '"chief officer" AND "PSV" OR "platform supply"';
echo $sourcestring = '"chief officer" AND "platform AND supply" OR "psv" not iam NOT "you" and ("find" or "set") not iii and "you" or "he" AND all NOT candy AND andy and xor AND "xxor"';
//echo $sourcestring = 'xor and nor';
echo '<br>';

$boolStrObj = new StrToBooleanStr($sourcestring);
echo
$boolStrObj->convertStrToBoolean();



  Files folder image Files (2)  
File Role Description
Plain text file class.boolean_string.php Class class boolean_string.php
Accessible without login Plain text file index.php Example index.php

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:213
This week:0
All time:8,336
This week:52Up