Voting

: six plus zero?
(Example: nine)

The Note You're Voting On

lincoln dot mahmud at gmail dot com
6 years ago
Get Group match letter
<?php 
$s= 'aaabbbcceeffaaeeeaaabbzmmm';
function groupby( $s ){
 static $a = [];
 static $i = 0;
 
 $o = strspn( $s, $s[$i], $i);
 $a[ $i ] = [ $s[$i] => $o ];
 $i += $o;
 
 if( $i < strlen($s) ) {
 groupby($s);
 }
 return $a;
}
print_r(groupby($s));
?>

<< Back to user notes page

AltStyle によって変換されたページ (->オリジナル) /