Calculator configuration: PHP Code

  • Font size: Larger Smaller
  • Hits: 91
  • Print

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.

Calcbuilder for Joomla 4

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.

And if you don't want to write PHP code?

You can replace this code section with an spreadsheet able to perform the calculations, please check the Spreadsheet tutorial section to get more information.

Last modified on
Trackback URL for this blog entry.

Our clients' feedback