3v4l.org

run code in 300+ PHP versions simultaneously
<?php // price matrix: first index is y-axis, second is x-axis $prices = [ 600 => [ 600 => 224, 700 => 246, 800 => 266, 900 => 291, 1000 => 313 ], // here you put the rest... ]; //then echo the table; echo "<table><tr>"; echo "<td></td>"; // first empty cell; foreach ($prices[array_keys($prices)[0]] as $y_axis => $xprices){ echo "<td>".$y_axis."</td>"; } echo "</tr>";//finish setting up the header foreach ($prices as $y_axis => $xprices) { echo "<tr>"; echo "<td>".$y_axis."</td>"; foreach($xprices as $y_axis=> $price){ echo "<td>".$price."</td>"; } echo "</tr>"; } echo "</table>";
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 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><tr><td></td><td>600</td><td>700</td><td>800</td><td>900</td><td>1000</td></tr><tr><td>600</td><td>224</td><td>246</td><td>266</td><td>291</td><td>313</td></tr></table>

preferences:
231.37 ms | 404 KiB | 335 Q