Calculator configuration: PHP Code
Inside this code area you will be able to specify the operations of your calculator in a manual way, using php valid syntax. This code area will be executed everytime frontend users click 'Calculate' button, or if any inline calculation is launched. Input variables, and any other variable created at this section can be used afterwards at the output section.
Here you can write down the formulas needed to get your results. Basic rules are:
- the result of the expression is written on the left
- each variable must be preceeded by the $ sign
- each calculation must end with a ;
So, in order to sum variables 'num1' and 'num2', and store the result in a new variable called 'sum', you must enter:
You have available a big set of operations and functions, control structures, like conditional operators or loops, constants..etc, the whole language reference can be found here:
You have at the left side some code tips to help you with some common functions, and also the code panel has some helper buttons that can help you to introduce your math expressions.