3v4l.org

run code in 300+ PHP versions simultaneously
<?php $newarray =array( "make"=> "Ford" , "model"=> "S-MAX" , "model_year"=> "2009" , "made"=> "2010-01-01" , "manufacturer"=> "Ford Werke AG" , "manufacturer_address"=> "Koeln-Niehl, Germany" , "body"=> "Sedan/Saloon" , "engine_power_kw"=> "142" , "engine_displacement_ccm"=> "2000" , "engine_full"=> "2.0L Duratorq-TDCi (143PS) - DW" ); $rama_result = $rama_result1 = $rama_result2 = ''; for ($c = count($newarray); $c % 4 != 0; $c++) { $newarray[str_repeat("\n", $c % 4)] = ''; } $rama_result.='<table class="table w100 customtable">'; $i=1; foreach($newarray as $key=>$value){ $rama_result1.= '<th>'.$key.'</th>'; $rama_result2.= '<td>'.$value.'</td>'; if($i % 4 == 0){ $rama_result.='</tr><tr>'.$rama_result1.'</tr><tr>'.$rama_result2.'</tr><tr>'; $rama_result1 = '';$rama_result2 = ''; } $i++; } $rama_result.='</tr></table>'; echo $rama_result;
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.16, 8.5.0 - 8.5.1
<table class="table w100 customtable"></tr><tr><th>make</th><th>model</th><th>model_year</th><th>made</th></tr><tr><td>Ford</td><td>S-MAX</td><td>2009</td><td>2010-01-01</td></tr><tr></tr><tr><th>manufacturer</th><th>manufacturer_address</th><th>body</th><th>engine_power_kw</th></tr><tr><td>Ford Werke AG</td><td>Koeln-Niehl, Germany</td><td>Sedan/Saloon</td><td>142</td></tr><tr></tr><tr><th>engine_displacement_ccm</th><th>engine_full</th><th> </th><th> </th></tr><tr><td>2000</td><td>2.0L Duratorq-TDCi (143PS) - DW</td><td></td><td></td></tr><tr></tr></table>

preferences:
159.84 ms | 409 KiB | 5 Q