Try this solution it will help in your case:
$prices = [
0,
100,
200,
300,
];
$no = 1;
echo "Prices <br>";
foreach($prices as $price)
{
if($price != 0){
echo "No" . $no . " = " . $price . "<br>";
}
$no++;
}
1
solved Numbering data Using Foreach php [closed]