Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding boolean logic #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Adding boolean logic #22

wants to merge 2 commits into from

Conversation

Lapinskas
Copy link

Logical operators like |, & and ! could be used if values are boolean.

Example:

$evaluator->variables = [ 'a' => true, 'b' => false ]; echo $evaluator->execute('a & !b');

@Lapinskas
Copy link
Author

Hello @madorin ,

I hope you will find this feature interesting!

@madorin
Copy link
Owner

madorin commented Feb 8, 2021

@Lapinskas , did a very quick look over the code, overall it seems nice and fit well into current design.
I'll check/test it a bit more in a few days and if all fine, will merge it into mainstream.
Thanks for your involvement and time!

Think for full support we still need a kind of >, <, <=, >= operators also, to have expressions like "(2 > a) & b".
Saw spreadsheet engines supports it.
Currently this feature is not a top one for me, as we use it mainly for numbers, financial calculations, but indeed, could be very usefull for others ;)

@Lapinskas
Copy link
Author

You're right, @madorin , that feature could be useful.
I have just implemented direct needs of my project, but will think about adding support of other boolean operands as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants