-1

How to fix the error Call-time pass-by-reference has been removed in C:\xampp\php\pear\Spreadsheet\Excel\Writer\Worksheet.php on line 2490 I am getting this error when I am trying to insert user data into excel sheet using php` I used the following code for inserting the data into excel file. Please help me to fix this error.Thanks

<?php
$data = array(
array('', 'Math', 'Literature', 'Science'),
array('John', 24, 54, 38),
array('Mark', 67, 22, 57),
array('Tim', 69, 32, 58),
array('Sarah', 81, 78, 68),
array('Susan', 16, 44, 38),
);
include 'Spreadsheet/Excel/Writer.php';

$excel = new Spreadsheet_Excel_Writer('grades.xls');
// add worksheet
$sheet =& $excel->addWorksheet('Class I');
// add data to worksheet
$rowCount=0;
foreach ($data as $row) {
foreach ($row as $key => $value) {
$sheet->write($rowCount, $key, $value);    
}  
$rowCount++;
} 
  • Note that in this case, the call-time pass-by-reference appears to be inside the `Spreadsheet_Excel_Writer` class, not in the code shown. If that's a third-party library, you'll need to file a bug against it for PHP 5.4-compatibility (or dig into it and patch appropriately). – IMSoP Sep 17 '14 at 16:10
  • It means the Excel Writer library needs to be updated from *ancient* to *modern* PHP. – deceze Sep 17 '14 at 16:10

1 Answers1

0

It's not something you fix. Call-time pass-by-reference really was removed from PHP. Your function needs to be written such that it accepts a reference:

function (&$var)
wavemode
  • 2,076
  • 1
  • 19
  • 24