3v4l.org

run code in 300+ PHP versions simultaneously
<?php // This library is to rewrite MSYQL queries into formatted text class query2text { private $key_arr; public function addline ($query,$keyword) { $fixed = str_ireplace(" ".$keyword,"<br>&nbsp;".$keyword,$query); return $fixed; } public function convert($query) { $key_arr = array("FROM","LEFT JOIN","RIGHT JOIN","INNER JOIN","OUTER JOIN","WHERE","AND","OR","ORDER","GROUP"); foreach($key_arr AS $key) { $query = $this->addline($query,$key); } $query .= "<br><br>\n"; return $query; } } $query = "SELECT patients.patient_id,patients.last_name,patients.first_name,appts.*,appt_types.type,appt_types.color,appt_types.bgcolor" . ",DATE_FORMAT(appts.start,'%m/%d/%Y') AS date" . ",DATE_FORMAT(appts.start,'%h:%i %p') AS time" . ",TIMEDIFF(appts.end,appts.start) AS duration" . " FROM patients,appts,appt_types" . " WHERE appts.cancelled IS NULL" . " AND YEAR(appts.start)='" . $year . "'" . " AND MONTH(appts.start)='" . $month . "'" . " AND DAY(appts.start)='" . $day . "'" . " AND patients.patient_id = appts.patient_id" . " AND appts.type = appt_types.appt_type_id"; $q2t = new query2text(); echo "<hr>" . $q2t->convert($query) . "<hr>\n";
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $year in /in/3TqDc on line 34 Warning: Undefined variable $month in /in/3TqDc on line 35 Warning: Undefined variable $day in /in/3TqDc on line 36 <hr>SELECT patients.patient_id,patients.last_name,patients.first_name,appts.*,appt_types.type,appt_types.color,appt_types.bgcolor,DATE_FORMAT(appts.start,'%m/%d/%Y') AS date,DATE_FORMAT(appts.start,'%h:%i %p') AS time,TIMEDIFF(appts.end,appts.start) AS duration<br>&nbsp;FROM patients,appts,appt_types<br>&nbsp;WHERE appts.cancelled IS NULL<br>&nbsp;AND YEAR(appts.start)=''<br>&nbsp;AND MONTH(appts.start)=''<br>&nbsp;AND DAY(appts.start)=''<br>&nbsp;AND patients.patient_id = appts.patient_id<br>&nbsp;AND appts.type = appt_types.appt_type_id<br><br> <hr>

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
49.61 ms | 402 KiB | 8 Q