3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $table_arr = array('al5data','al6data'); //if (empty($table_arr)) $table_arr[]=$this->table; //if (in_array('al5data',$table_arr)) $idfield = 'dataid'; // else $idfield = 'data_id'; //if (empty($id_arr)) $id_arr = $this->id_arr; $query =""; foreach ($table_arr AS $table) { $idfield = $this->getPriKey($table); if ($this->getTable() !== $table) $query .= " UNION "; $query .= "(SELECT `$idfield`, `pt_last_name`, `pt_first_name`, `start_date`, \"" . $table . "\" AS `table` FROM `" . $table . "`)"; } $query .= " ORDER BY STR_TO_DATE(`start_date`, '%m/%d/%Y') DESC, `$idfield` DESC LIMIT 0,100"; echo $query;
based on BppXM
Output for 7.0.0 - 7.3.0alpha1
Fatal error: Uncaught Error: Using $this when not in object context in /in/vIeic:13 Stack trace: #0 {main} thrown in /in/vIeic on line 13
Process exited with code 255.
Output for 5.6.0 - 5.6.25
Fatal error: Using $this when not in object context in /in/vIeic on line 13
Process exited with code 255.