Skip to content

Instantly share code, notes, and snippets.

@asadali3210
Created May 31, 2017 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asadali3210/745c0499f47f6df4b5dac35b784184ee to your computer and use it in GitHub Desktop.
Save asadali3210/745c0499f47f6df4b5dac35b784184ee to your computer and use it in GitHub Desktop.
function getLongestSequence($arr){
$output =0;
$size =1;
$character = '';
foreach($arr as $char){
if ( $char == $character ){
$size++;
}
else {
if ( $size >= $output){
$output = $size;
$character = $char;
}
$size =1;
}
}
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment