Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy. This forum is not for asking programming related questions.
<?php
function countMaxOcc($tpp, $s){
// set variables
$t=0;$c=0;$p=true;
// $tpp should be an array, foreach loops through each
// value in an array
foreach($tpp as $n){
// if the value $n is equal to the value of $s
if($n==$s){
// if $p is true, $c is incremented by 1, if $p is false, $c = 1
$c=($p)?$c+1:1;
// set $p to true
$p=true;
// if $n is not equal to $s
}else{
// if $c is greater than $t, $t is equal to the value of $c, if not, $t's value
// is equal to the value in $t.
$t=($c>$t)?$c:$t;
// $p is set to false
$p=false;
}
}
// return the value of $t
return $t;
}
?>
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering