codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php $results = array( '1', '18', '18', '1', '1', '1', '1', '1', '18', '18'); $new = array(); $count = count( $results) - 1; for( $i = 0, $j = 1; $i < $count; $i = $j, $j = $i + 1) { while( $results[$i] === $results[$j]) $j++; $new[] = array_slice( $results, $i, $j - $i); } print_r( $new);
Private
[
?
]
Run code
Submit