Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Zephir: ParseException

I am trying to compile the below code in zephir language and it gives me Parse error. I am not sure what am I doing wrong.

public static function calculateDiscrepancy(tpImpr, liImpressions, defaults) {
        var numeratorx = 1-(tpImpr + defaults);
        if numeratorx != 0 && liImpressions != 0 {
              return (double)(numeratorx / liImpressions) * 100;
            return 0;


Zephir\ParseException: Syntax error in /var/www/vhosts/app/advertisingcalculator.zep on line 58

 var numeratorx = 1-(tpImpr + defaults);

Any Ideas?

edited Apr '14

Hi You can try, Replace code the content following

var numeratorx = 1-(tpImpr + defaults);


var numeratorx;
let numeratorx = 1-(tpImpr + defaults);

That worked thanks!