First method:
<?php $array = array(0,100,0,150,0,200); echo "<pre>"; print_r($array); echo "</pre>"; foreach($array as $array_item){ if($array_item==0){ unset($array_item); } echo"<pre>"; print_r($array_item); echo"</pre>"; } ?>
Second method: Use array_diff
<?php $array = array(0,100,0,150,0,200); $remove = array(0); $result = array_diff($array, $remove); echo"<pre>"; print_r($result); echo"</pre>"; ?>
source share