I need to find the minimum and maximum in a multidimensional array in PHP, I have what I thought would work below but it keeps giving me a parse error, this is homework and I am not asking anyone to do it for me but I am a beginner and any help would be appreciated.
<?php
/* 2 dimensional array in PHP - strictly an array of arrays */
$multable[] = array("11", "12", "15", "22", "41", "42");  
$multable[] = array("6", "7", "16", "17", "22", "23");  
$multable[] = array("1", "15", "16", "20", "22", "3");  
<table>
<?php
/* display a table from a 2D array */
for ($j=0;$j<3;$j++) {
    print "<tr>";
    for ($k=0;$k<6;$k++) {
        echo "<td>",$multable[$j][$k],"</td>";
    }
    print "</tr>";
    $max_value = 0;
    foreach ($multable as $myMax) {
        if ($max_value<$myMax) {
            $max_value = $myMax;
        }
    }
echo $max_value;
?>
</table>
                There is also a one-liner for that:
$max = max( array_map("max", $multable) );
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With