php - Else break deletes variable -
i going through series of values checking if same or different, want how many values @ top of list same.
$counter=0; while ($value<$numberofvalues){ if($valuea == $valueb){ $counter++; }else{ break; } } echo $counter; why $counter equals 0 after break?
thanks in advance!
because value , numberofvalues should have $ in front of them ($value , $numberofvalues), otherwise while() loop not run @ , $counter still 0.
Comments
Post a Comment