diff options
author | Bruce Wells <brucekwells@gmail.com> | 2020-07-27 19:25:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-27 19:25:59 +0300 |
commit | 44d72cc252974ac36cc138591aac785022760a50 (patch) | |
tree | f91391945ab9eea944a785209d6db1698e1529cc /README.md | |
parent | b38893d672f479314e8b9f254457b8b9755c781f (diff) |
Better setVar error message (#70)V2.1.1
Additional unit tests
Readme update
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1,4 +1,4 @@ -# MathExecutor [![Tests](https://github.com/neonxp/MathExecutor/workflows/Tests/badge.svg)](https://github.com/neonxp/MathExecutor/actions?query=workflow%3ATests) [![Latest Packagist release](https://img.shields.io/packagist/v/nxp/math-executor.svg)](https://packagist.org/packages/nxp/math-executor) +# MathExecutor [![Tests](https://github.com/neonxp/MathExecutor/workflows/Tests/badge.svg)](https://github.com/neonxp/MathExecutor/actions?query=workflow%3ATests) # A simple and extensible math expressions calculator @@ -115,6 +115,8 @@ You can think of the **if** function as prototyped like: function if($condition, $returnIfTrue, $returnIfFalse) ``` ## Variables: +Variables can be prefixed with the dollar sign ($) for PHP compatibility, but is not required. + Default variables: ``` @@ -127,7 +129,7 @@ You can add your own variables to executor: ```php $executor->setVar('var1', 0.15)->setVar('var2', 0.22); -echo $executor->execute("$var1 + $var2"); +echo $executor->execute("$var1 + var2"); ``` You can dynamically define variables at run time. If a variable has a high computation cost, but might not be used, then you can define an undefined variable handler. It will only get called when the variable is used, rather than having to always set it initially. |