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);$i++){ $body .= $arr[$i]; } $body .= $endFila."\n"; } } $body .= $endTable; echo $body;
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Warning: Undefined array key 0 in /in/t8LRg on line 110 Warning: Undefined array key 1 in /in/t8LRg on line 110 Warning: Undefined array key 0 in /in/t8LRg on line 110 Warning: Undefined array key 1 in /in/t8LRg on line 110 <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> </tr> <tr> </tr> </table>
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: Undefined array key 0 in /in/t8LRg on line 110 Warning: Undefined array key 1 in /in/t8LRg on line 110 Warning: Undefined array key 0 in /in/t8LRg on line 110 Warning: Undefined array key 1 in /in/t8LRg on line 110 <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> </tr> <tr> </tr> </table>
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 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.31, 7.4.0 - 7.4.33
Notice: Undefined offset: 0 in /in/t8LRg on line 110 Notice: Undefined offset: 1 in /in/t8LRg on line 110 Notice: Undefined offset: 0 in /in/t8LRg on line 110 Notice: Undefined offset: 1 in /in/t8LRg on line 110 <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> </tr> <tr> </tr> </table>
Output for 7.3.32 - 7.3.33
<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> </tr> <tr> </tr> </table>
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
Notice: Undefined offset: 0 in /in/t8LRg on line 110 Notice: Undefined offset: 1 in /in/t8LRg on line 110 Notice: Undefined offset: 0 in /in/t8LRg on line 110 Notice: Undefined offset: 1 in /in/t8LRg on line 110 <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> </tr> <tr> </tr> </table>

preferences:
245.82 ms | 403 KiB | 339 Q