phpexcelexcel-import

When i am trying to export excel file in php 7 same code is working in php5


When i am trying to export excel file in php 7 same code is working in php5

$worksheet =& new writeexcel_worksheet($name, $index, $this->_activesheet, $this->_firstsheet, $this->_url_format, $this->_parser, $this->_tempdir);

Parse error: syntax error, unexpected 'new' (T_NEW) in C:\xampp\htdocs\developer\wp-content\plugins\liveunited-payments\php_writeexcel\class.writeexcel_workbook.inc.php on line 190


Solution

  • php7 is not fully compatible with php5, in most cases you have to refactor some code.

    First, try to remove "&" near "new"

    $worksheet =new writeexcel_worksheet($name, $index, $this->_activesheet,
                                      $this->_firstsheet,
                                      $this->_url_format, $this->_parser,
                                      $this->_tempdir);
    

    I noticed that error causes in some external library. The best way is update that vendor to version with php7 support