3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function mostrarTabla($fid, $alert) { $flights = new Flights; $aircrafts = $flights->getAircrafts(); $products = $flights->getProducts(); $cities = $flights->getFlightDetails($fid); $check = $flights->checkId($fid); $selAircraft = "<select name='aircraft' id='aircraft' onchange=\"calculate('aircraft','" . $check['id'] . "',this.value)\"><option value=''>Aircraft</option>"; foreach ($aircrafts as $rc => $rv) { if ($rv['id'] === $check['aircraftType']) { $selAircraft .= "<option value='" . $rv['id'] . "' selected='selected'>" . $rv['model'] . "</option>"; } else { $selAircraft .= "<option value='" . $rv['id'] . "'>" . $rv['model'] . "</option>"; } } $selAircraft .="</select>"; $line1 = "<tr><td style='border:1px solid black;'>" . $selAircraft . "</td>" . "<td style='border:1px solid black;'>ETA</td>"; foreach ($cities as $r => $t) { if ($t['eta'] === "00:00:00") { $eta = ""; } else { $hora = explode(":", $t['eta']); $h = $hora[0]; $m = $hora[1]; $hf = $h . ":" . $m; $eta = $hf; } if ($t['row'] === "1") { $line1 .= "<td style='border:1px solid black;' ></td>"; } else { $line1 .= "<td style='border:1px solid black;' > <input type='text' name='eta-" . $t['row'] . "' id='eta-" . $t['row'] . "' value='" . $eta . "' size='5' readonly='readonly' /></td>"; } } $line1 .="</tr>"; $line2 = "<tr><td style='border:1px solid black;'>" . "<input type='text' size='5' name='registration' placeholder='Registration' onblur=\"saveForm('registration'," . $check['id'] . ",this.value,0);\" value='" . $check['registration'] . "'/></td>" . "<td style='border:1px solid black;'>Airport</td>"; foreach ($cities as $r => $t) { $line2 .= "<td style='border:1px solid black;'>" . "<input type='text' name='aep-" . $t['row'] . "' id='aep-" . $t['row'] . "' onblur=\"calculate('aep-" . $t['row'] . "'," . $check['id'] . ",this.value)\" value='" . $t['aep'] . "' size='5'/>" . "</td>"; } $line2 .="</tr>"; $line3 = "<tr><td style='border:1px solid black;'>CREW</td>" . "<td style='border:1px solid black;'>ETD</td>"; foreach ($cities as $r => $t) { if ($t['etd'] === "00:00:00") { $etd = ""; } else { $hora = explode(":", $t['etd']); $h = $hora[0]; $m = $hora[1]; $hf = $h . ":" . $m; $etd = $hf; } if ($t['row'] === "1") { $line3 .= "<td style='border:1px solid black;'>" . "<input type='text' name='etd-" . $t['row'] . "' id='etd-" . $t['row'] . "' onblur=\"calculate('etd-" . $t['row'] . "'," . $check['id'] . ",this.value)\" value='" . $etd . "' size='5'/>" . "</td>"; } else { $line3 .= "<td style='border:1px solid black;'>" . "<input type='text' name='etd-" . $t['row'] . "' id='etd-" . $t['row'] . "' readonly='readonly' value='" . $etd . "' size='5'/>" . "</td>"; } } $line3 .="</tr>"; $line4 = "<tr><td style='border:1px solid black;'>" . "<input type='text' size='5' name='crew1Name' placeholder='Crew Name' onblur=\"saveForm('crew1Name'," . $check['id'] . ",this.value,0);\" value='" . $check['crew1Name'] . "'/></td>" . "<td style='border:1px solid black;'>PRODUCT</td>"; foreach ($cities as $r => $t) { $selproducts = "<select name='products-" . $t['row'] . "' id='products' onchange=\"saveForm('products'," . $check['id'] . ",this.value," . $t['row'] . ");\"><option value=''>Select</option>"; foreach ($products as $y => $u) { if($u['id'] === $t['products']){ $selproducts .= "<option value='" . $u['id'] . "' selected='selected'>" . $u['product'] . "</option>"; }else { $selproducts .= "<option value='" . $u['id'] . "'>" . $u['product'] . "</option>"; } } $selproducts .="</select>"; $line4 .= "<td style='border:1px solid black;'>" . $selproducts . "</td>"; } $line4 .="</tr>"; $line5 = "<tr><td style='border:1px solid black;'>" . "<input type='text' size='5' name='crew2Name' placeholder='Crew Name' onblur=\"saveForm('crew2Name'," . $check['id'] . ",this.value,0);\" value='" . $check['crew2Name'] . "'/></td>" . "<td style='border:1px solid black;'>CLIENT</td>"; foreach ($cities as $r => $t) { $line5 .= "<td style='border:1px solid black;'> <input type='text' name='client-" . $t['row'] . "' size='5' placeholder='Client' onblur=\"saveForm('client'," . $check['id'] . ",this.value," . $t['row'] . ");\" value='" . $t['client'] . "'/></td>"; } $line5 .="</tr>"; $line6 = "<tr><td style='border:1px solid black;'>" . "<input type='text' size='5' name='crew3Name' placeholder='Crew Name' onblur=\"saveForm('crew3Name'," . $check['id'] . ",this.value,0);\" value='" . $check['crew3Name'] . "'/></td>" . "<td style='border:1px solid black;'>FLT #s</td>"; foreach ($cities as $r => $t) { $line6 .= "<td style='border:1px solid black;'>" . "<input type='text' size='5' name='status-" . $t['row'] . "' onblur=\"saveForm('status'," . $check['id'] . ",this.value,".$t['row'].");\" placeholder='Status' value='" . $t['status'] . "' /></td>"; } $line6 .="</tr>"; $line7 = "<tr><td style='border:1px solid black;'> <input type='text' size='5' name='crew4Name' placeholder='Crew Name' onblur=\"saveForm('crew4Name'," . $check['id'] . ",this.value,0);\" value='" . $check['crew4Name'] . "'/></td> <td style='border:1px solid black;'>Turn time</td>"; foreach ($cities as $r => $t) { if ($t['turntime'] === "") { $turntime = "0"; } else { $turntime = $t['turntime']; } if ($t['row'] === "1") { $line7 .= "<td style='border:1px solid black;' ></td>"; } else { $line7 .= "<td style='border:1px solid black;' >" . "<input type='text' size='5' name='turntime-" . $t['row'] . "' onblur=\"calculate('turnTime-" . $t['row'] . "'," . $check['id'] . ",this.value)\" id='turnTime-" . $t['row'] . "' value='" . $turntime . "' /></td>"; } } $line7 .="</tr>"; if ($alert === "") { $cartel = ""; } else { $cartel = "<div id='alert'>" . $alert . "</div>"; } $tabla = $cartel . ' <div id="flight-' . $check['id'] . '"> <input type="hidden" id="planeModel" name="planeModel" value="' . $check['aircraftType'] . '" /> <table class="fixed" style="border: 1px solid black" id="flights"> <col width="10%" /><col width="10%" /><col width="10%" /> <col width="10%" /><col width="10%" /><col width="10%" /> <col width="10%" /><col width="10%" /><col width="10%" /> <col width="10%" /><col width="10%" /><col width="10%" /> <col width="10%" /><col width="10%" /><col width="10%" /> <col width="10%" /><col width="10%" />' . $line1 . $line2 . $line3 . $line4 . $line5 . $line6 . $line7 . ' </table></div>'; return $tabla; } function mostrar($ultimo){ $linea = "<pre>".print_r($ultimo).var_dump($ultimo)."</pre>"; return $linea; }
based on NcZ0n
Output for 5.4.0 - 7.2.0