$value){ if ($week[$key] === "o"){ $count ++; } else { $ans = max($count, $ans); $count = 0; } } echo max($ans, $cnt);