3v4l.org

run code in 300+ PHP versions simultaneously
<?php $body = ""; $table = "<table style=\"margin: 0 auto;\" border=\"2\" summary=\"Average per Channel\">"; $endTable = "</table>"; $fila = "<tr>"; $endFila = "</tr>"; $cabecera = "<th colspan=\"2\">"; $endCabecera = "</th>"; $detalle = "<td colspan=\"1\">"; $endDetalle = "</td>"; $bold = "<strong>"; $endBold = "</strong>"; $body = $table."\n".$fila; $arr_header_detalle = array(); $arr["functional"]["online"] = "0.9080"; $arr["functional"]["retail"] = "0.4080"; $arr["regression"]["online"] = "0.5080"; $arr["integration"]["online"] = "0.3080"; $arr["integration"]["retail"] = "0.2080"; $tpt = array("automation","functional","regression","integration"); $ch = array("Agnostic","Online","Retail"); for($i=0;$i<sizeOf($tpt);$i++){ $aux_tpt = $tpt[$i]; if(array_key_exists($aux_tpt ,$arr)){ $arr_header_detalle[$aux_tpt]["header"] = $cabecera.$bold.$aux_tpt.$endBold.$endCabecera."\n"; if(isset($arr[$aux_tpt]["online"])){ $arr_header_detalle[$aux_tpt]["Online"] = $detalle.$bold."Online".$endBold.$endDetalle."\n". $detalle.number_format($arr[$aux_tpt]["online"], 2, "." , ".")."%".$endDetalle."\n"; } if(isset($arr[$aux_tpt]["retail"])){ $arr_header_detalle[$aux_tpt]["Retail"] = $detalle.$bold."Retail".$endBold.$endDetalle."\n". $detalle.number_format($arr[$aux_tpt]["retail"], 2, "." , ".")."%".$endDetalle."\n"; } } } for($i=0;$i<sizeOf($tpt);$i++){ $aux_tpt = $tpt[$i]; if(array_key_exists($aux_tpt ,$arr_header_detalle)){ $body .= $arr_header_detalle[$aux_tpt]["header"]; } } $body .= $endFila."\n"; $arr = array("Online"=>array(),"Retail"=>array()); for($i=0;$i<sizeOf($tpt);$i++){ $aux_tpt = $tpt[$i]; if(array_key_exists($aux_tpt ,$arr_header_detalle)){ for($j=0;$j<sizeOf($ch);$j++){ $aux_ch = $ch[$j]; if(isset($arr_header_detalle[$aux_tpt][$aux_ch])){ switch($aux_ch){ case "Online": array_push($arr[$aux_ch],$arr_header_detalle[$aux_tpt][$aux_ch]); break; case "Retail": array_push($arr[$aux_ch],$arr_header_detalle[$aux_tpt][$aux_ch]); break; } } } } } for($j=0;$j<sizeOf($ch);$j++){ $aux_ch = $ch[$j]; if(array_key_exists($aux_ch,$arr)){ $body .= $fila."\n"; for($i=0;$i<sizeOf($arr[$aux_ch]);$i++){ $body .= $arr[$aux_ch][$i]; } $body .= $endFila."\n"; } } $body .= $endTable; echo $body;
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
<table style="margin: 0 auto;" border="2" summary="Average per Channel"> <tr><th colspan="2"><strong>functional</strong></th> <th colspan="2"><strong>regression</strong></th> <th colspan="2"><strong>integration</strong></th> </tr> <tr> <td colspan="1"><strong>Online</strong></td> <td colspan="1">0.91%</td> <td colspan="1"><strong>Online</strong></td> <td colspan="1">0.51%</td> <td colspan="1"><strong>Online</strong></td> <td colspan="1">0.31%</td> </tr> <tr> <td colspan="1"><strong>Retail</strong></td> <td colspan="1">0.41%</td> <td colspan="1"><strong>Retail</strong></td> <td colspan="1">0.21%</td> </tr> </table>

preferences:
298.44 ms | 407 KiB | 358 Q