Open falinhares opened 7 years ago
I've installed math-executor through Composer, ran some tests on the first code and came to this issue:
Code: require "vendor/autoload.php"; $calculator = new \NXP\MathExecutor(); print $calculator->execute("1 + 2 * (2 - (4+10))^2 + sin(10)"); print $calculator->execute("(4+10)^2"); Output: -19.544021110889 Notice: Undefined offset: -1 in C:\xampp\htdocs\math\vendor\nxp\math-executor\src\NXP\Classes\Lexer.php on line 107
Fatal error: Call to a member function getPriority() on null in C:\xampp\htdocs\math\vendor\nxp\math-executor\src\NXP\Classes\Lexer.php on line 107
How can I fix this?
Hello falinhares, there are some bugs when using a lot of parentheses. I would suggest using the following package, Executor
but the expression delivering the error is (4+10)^2
I've installed math-executor through Composer, ran some tests on the first code and came to this issue:
Code: require "vendor/autoload.php"; $calculator = new \NXP\MathExecutor(); print $calculator->execute("1 + 2 * (2 - (4+10))^2 + sin(10)"); print $calculator->execute("(4+10)^2"); Output: -19.544021110889 Notice: Undefined offset: -1 in C:\xampp\htdocs\math\vendor\nxp\math-executor\src\NXP\Classes\Lexer.php on line 107
Fatal error: Call to a member function getPriority() on null in C:\xampp\htdocs\math\vendor\nxp\math-executor\src\NXP\Classes\Lexer.php on line 107
How can I fix this?