<? $string="1 0 1 0 1 1 0"; $total=explode(' ', $string); $total2=count($total); for($i=0;$i<$total2;$i++){ echo $total[$i]."<br>"; } ?>