This is a tricky one to explain. I have an associative array which I want to run a set of rules against to return true or false.
I was wondering if there is a library somewhere allowing me to compare a rule (or set of) against an array. Almost like SQL exept I have the record, I just need to see if the SQL would return it or not.
For Example:
$subject = array('name' => 'John Smith', 'age' => '44');
$formula = "name LIKE 'John%' AND (age = 44 OR age = 45)";
if(match($formula, $subject))
return true;
else
return false;
The subject array is NOT from a database it is actually from a form post, otherwise I would just run the SQL and if it returned the correct record then it would be true. Plus this is something that I would like to use a lot with may different associative arrays so adding to a table then running the query to get the same record back will not be possible either. Basically I can't use a database.