带有for循环的PHP数组

i have array of 10 item and each item has own price.

i have to select some item and display the selected item's average and if any of selected item's above the average i have to display it's pic in 2x2 table different pic in each cell.

i write this code but the problem is the pic repeat in the 4 cell's:

    <?php
echo "<table border=2>";
$incVar = 0;
for ($x = 0; $x < 2; $x++) {
    echo"<tr>";

    for ($y = 0; $y < 2; $y++) {

        echo"<td>";
        while($incVar <=9){
        if (isset($camera[$incVar]) && $camera[$incVar] >= $avreag){
                echo '<img src="' . $pic[$incVar] . '" width="200" height="200">';
            }
        $incVar++;
    }

        echo "</td>";
    }


    echo "</tr>";
}
echo "</table>";
?>

first you have to create image array because if you will display in this manner and if some items does not match the condition then it will leave blank <td> solution :

<?php
echo "<table border=2>";
$incVar = 0;
for ($x = 0; $x < 2; $x++) {
    echo"<tr>";

    for ($y = 0; $y < 2; $y++) {
        echo"<td>";
        if (isset($camera[$incVar]) && $camera[$incVar] >= $avreag) {
                echo '<img src="' . $pic[$incVar] . '" width="200" height="200">';
            }
        $incVar++;
        echo "</td>";
    }
    echo "</tr>";
}
echo "</table>";
?>

no you need to display $imagesArr in 4x4 for loop