PHP Classes
elePHPant
Icontem

File: src/NXP/Classes/Token/TokenDivision.php

Recommend this page to a friend!
  Classes of Alexander Kiryukhin  >  PHP Math Expression Evaluator  >  src/NXP/Classes/Token/TokenDivision.php  
File: src/NXP/Classes/Token/TokenDivision.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Math Expression Evaluator
Parse and evaluate strings with math expressions
Author: By
Last change: Logicandcompare (#50)

* TokenFactory: allowing multicharacter tokens

* Added logical and compare operators: <, <=, >, >=, ==, !=, ||, &&

* Fixed operator priorities

* Error messages fixes

* Fixed operators priority

The priorities are assigned by following the php language standard
(https://www.php.net/manual/en/language.operators.precedence.php)
I've assigned precedence in steps of 10 units by following the linked page:
230 clone new
220 **
210 ++ -- ~ (int) (float) (string) (array) (object) (bool) @
200 instanceof
190 !
180 * / %
170 + - .
160 << >>
150 < <= > >=
140 == != === !== <> <=>
130 &
120 ^
110 |
100 &&
90 ||
80 ??
70 ? :
60 = += -= *= **= /= .= %= &= |= ^= <<= >>=
50 yield from
40 yield
30 and
20 xor
10 or

* Added if() function

* Cache key fix

There are cases where the cache key creation raised an error, for example
while evaluating the expression "if(cos(2), cos(2), 0)", because the
if() function was passing a float to the MathExecutor:execute() method.
Date: 19 days ago
Size: 1,504 bytes

 

You need to be a registered user and login to get this file.

1,549,430 PHP developers registered to the PHP Classes site.
Be One of Us!

Login Immediately with your account on:

FacebookGmailHotmailStackOverflowGitHubYahoo