Abstract
Remember that CFO is interpreted in PHP, and PHP is a very strict language.
It’s case sensitive for functions, variables and reserved words.

It’s easy to forget a parenthesis and the formula will not work!!!
As silly as writing $Prce instead of $Price, we have experience in losing hours for this kind of issues, so please read slowly your formula before lose your mind.

We have tried to include all kind of checks in order to help you detect errors in your formulas, but keep in mind that in a complex one, sometimes a correct syntax are not equal a correct formula. Look at parenthesis and operators priority (*+- etc), and make all test you consider before activating a product with custom formula.

Basic Checklist
– Any of your calculations are divided by zero?
– All lines must end with a “;”, excluding conditionals which can end with “}” or “{”
– Texts and strings must be written between quotes, if you start with double quotes, you should end with double quotes too.
– Comparing variables is done with doble equal “==”, not with simple equal “=” which is used to assing values.
– Joining strings is done with “.” not with “+”, like: $DummyString = “string example” . “other string”;
– If you are using your own variables take care not using reserverd words, the better way to avoid it is to use a prefix like “$my”, for example “$myWidth”
– Review other Common Errors in formulas.

Logical operators
Customers are reporting us problems with some PHP installations when using “&&” “||” logical operators, so we reccoment to use “and” “or” when possible.
It’s related the way PHP parse the formula (eval function), not with CFO as is.

PHP Syntax Checker
An useful online tool is PHP Code Checker, you can copy and paste your formulas here, BUT, take in consideration that our {options_id}, {12}, {14}, etc… are special tricks used by CFO which this online tool doesn’t know, so, you can use variables instead, as we recommend in this article: Best practises writing formulas
Or just replace {12} by a value only for the syntax check.
PHP Code Checker: http://phpcodechecker.com