3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $do_excel = 1; $visual_na = '-'; $visual_taken = 'X'; $visual_required = 'R'; $employee_header = 'Employee'; $hire_date_header = 'Hire Date'; $percentage_header = 'Percentage of Required Complete'; $header_array = array($employee_header, $hire_date_header, $percentage_header); if(isset($_REQUEST['by'])) $split_by = strtolower($_REQUEST['by']); //department, manager, or undefined for single sheet //sorting algorithm function cmp_class($a, $b) { switch($a){ case $GLOBALS['employee_header']: return -1; case $GLOBALS['hire_date_header']: if($b == $GLOBALS['employee_header']) return 1; return -1; case $GLOBALS['percentage_header']: return 1; default: if($b == $GLOBALS['employee_header'] or $b == $GLOBALS['hire_date_header']) return 1; return $a > $b; } } //split function, to simplify getting a sheet where splits exists or a default sheet where it doesn't function getSheet($row_data){ if(isset($GLOBALS['split_by'])) return $row_data[$GLOBALS['split_by']]; return 'Sheet1'; } if(isset($_GET['form']) && $_GET['form'] == 'old'){$visual_na='N'; $visual_taken='X'; $visual_required=' ';}?>
based on tFh1U
Output for 4.3.0 - 7.2.0