PHP Classes

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

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


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  
Name: Aditya Sarkar <contact>
Classes: 2 packages by
Country: India India
Age: 33
All time rank: 48127 in India India
Week rank: 258 Up21 in India India Up
Innovation award
Innovation award
Nominee: 1x



//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);

  Files folder image Files  
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

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:8,333
This week:52Up