3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php <?php function cellColor($cells,$color){ global $objPHPExcel; $objPHPExcel->getActiveSheet()->getStyle($cells)->getFill() ->applyFromArray(array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'startcolor' => array('rgb' => $color) )); } $strana = 0; $mesiace = array( '01'=>'Január', '02'=>'Február', '03'=>'Marec', '04'=>'Apríl', '05'=>'Máj', '06'=>'Jún', '07'=>'Júl', '08'=>'August', '09'=>'September', '10'=>'Október', '11'=>'November', '12'=>'December' ); $pop = array( 'B' => 'VŽP', 'C' => 'Cena', 'D' => 'Zber', 'E' => 'Oleje', 'F' => 'Cena', 'G' => 'dátum/kg', 'H' => 'dátum/kg', 'I' => 'dátum/kg', 'J' => 'dátum/kg', 'K' => 'dátum/kg', 'L' => 'dátum/l', 'M' => 'dátum/l', 'N' => 'dátum/l' ); $pos = 0; for ($i = 1; $i <= 12; $i++) { $c = ($i< 10) ? '0'.$i : (string) $i; if ($i-1 > 0) $objPHPExcel->createSheet($i-1); $objPHPExcel->getSheet($i-1)->setTitle($mesiace[$c]); } $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(32); $eArra = array('E', 'G', 'H', 'I', 'J', 'K'); for ($y = 0; $y < count($eArra); $y++) { $objPHPExcel->getActiveSheet()->getColumnDimension($eArra[$y])->setWidth(15); } // Set page orientation, size, Print Area and Fit To Pages $objPageSetup = new PHPExcel_Worksheet_PageSetup(); $objPageSetup->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4); $objPageSetup->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT); $objPageSetup->setPrintArea("A1:N800"); $objPageSetup->setFitToWidth(1); $objPHPExcel->getActiveSheet()->setPageSetup($objPageSetup); ## function recode ($str) { $separator1 = ';'; $separator2 = '&#'; $tmp = explode($separator1, $str); foreach ($tmp as $key=>$value) { $pmt = explode($separator2, $value); foreach ($pmt as $key2=>$value2) { if (is_numeric($value2) && mb_strlen((string) $value2) < 4) $pmt[$key2] = mb_convert_encoding($separator2 . intval($value2) . $separator1, 'UTF-8', 'HTML-ENTITIES'); } $tmp[$key] = implode('', $pmt); } $output = implode('', $tmp); return preg_replace('/\s+/', ' ', $output); } $iterator = 0; foreach ($mesiace as $cislomesiaca=>$nazovmesiaca) { $pos = 0; $objPHPExcel->setActiveSheetIndex($iterator); foreach ($vystup as $key=>$value) { $prevadzka = $value['name']; $kontakt = $value['contact']; $info = $value['note']; $vzp = ($value['waste_vzp'] != 1) ? 'NIE' : 'ÁNO'; $cenavzp = ($value['waste_vzp'] != 1) ? '' : $value['price_vzp']; $zbervzp = ($value['waste_vzp'] != 1) ? '' : $value['collection_vzp'] . 'x'; $oleje = $value['contracts']; $cenaodpad = $value['waste_price']; foreach ($value['wastes'] as $key2=>$value2) { $mesiacik = $mesiace[$key2]; $objPHPExcel->getActiveSheet()->setCellValue('A4', $_GET['y'] . ' - ' . $nazovmesiaca); foreach ($value2 as $key3=>$value3) { foreach ($value3 as $datum=>$vaha) { if ($cislomesiaca == $key2) { } } } } // TBLR $objPHPExcel->getActiveSheet()->getStyle('A' . (7 + $pos) . ':N' . (7 + $pos))->getBorders()->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR); $objPHPExcel->getActiveSheet()->getStyle('A' . (7 + $pos) . ':N' . (7 + $pos))->getBorders()->getBottom()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR); $objPHPExcel->getActiveSheet()->getStyle('A' . (7 + $pos) . ':N' . (7 + $pos))->getBorders()->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR); $objPHPExcel->getActiveSheet()->getStyle('A' . (7 + $pos) . ':N' . (7 + $pos))->getBorders()->getRight()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR); // left $objPHPExcel->getActiveSheet()->getStyle('G' . (7 + $pos))->getBorders()->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR); $objPHPExcel->getActiveSheet()->getStyle('G' . (8 + $pos))->getBorders()->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR); $objPHPExcel->getActiveSheet()->getStyle('G' . (9 + $pos))->getBorders()->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR); $objPHPExcel->getActiveSheet()->getStyle('L' . (7 + $pos))->getBorders()->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR); $objPHPExcel->getActiveSheet()->getStyle('L' . (8 + $pos))->getBorders()->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR); $objPHPExcel->getActiveSheet()->getStyle('L' . (9 + $pos))->getBorders()->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR); // right $objPHPExcel->getActiveSheet()->getStyle('N' . (7 + $pos))->getBorders()->getRight()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR); $objPHPExcel->getActiveSheet()->getStyle('N' . (8 + $pos))->getBorders()->getRight()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR); $objPHPExcel->getActiveSheet()->getStyle('N' . (9 + $pos))->getBorders()->getRight()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR); // bottom $objPHPExcel->getActiveSheet()->getStyle('G' . (9 + $pos) . ':N' . (9 + $pos))->getBorders()->getBottom()->setBorderStyle(PHPExcel_Style_Border::BORDER_HAIR); cellColor('A' . (7 + $pos) . ':N' . (7 + $pos), 'EEEEEE'); cellColor('G' . (9 + $pos) . ':N' . (9 + $pos), 'EEEEEE'); $objPHPExcel->getActiveSheet()->getStyle('A' . (9 + $pos))->getAlignment()->setWrapText(true); foreach ($pop as $bunka=>$hodnota) { $objPHPExcel->getActiveSheet()->setCellValue($bunka . (7 + $pos), recode($hodnota)); } $objPHPExcel->getActiveSheet()->setCellValue('A' . (7 + $pos), recode($prevadzka)); $objPHPExcel->getActiveSheet()->setCellValue('A' . (8 + $pos), recode($kontakt)); $objPHPExcel->getActiveSheet()->setCellValue('A' . (9 + $pos), recode($info)); $objPHPExcel->getActiveSheet()->setCellValue('B' . (8 + $pos), recode($vzp)); $objPHPExcel->getActiveSheet()->setCellValue('C' . (8 + $pos), $cenavzp); $objPHPExcel->getActiveSheet()->setCellValue('D' . (8 + $pos), $zbervzp); $objPHPExcel->getActiveSheet()->setCellValue('E' . (8 + $pos), recode($oleje)); $objPHPExcel->getActiveSheet()->setCellValue('F' . (8 + $pos), $cenaodpad); $pos+=4; } $iterator++; } $objPHPExcel->setActiveSheetIndex(0); $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel); $objWriter->save($fileName); header("Content-Description: File Transfer"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=\"$fileName\""); readfile ($fileName); ?>
Output for 5.3.0 - 5.4.27
Parse error: syntax error, unexpected '<' in /in/bgsFj on line 3
Process exited with code 255.