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

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -