codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?php $array = array("PO", "OD", "PO", "OD", "OD", "OD", "OD", "PO", "OD", "PO", "OD", "OD"); $result = array(); $index = -1; foreach ($array as $value) { if ($value == "PO") { $index++; } $result[$index][] = $value; } ?> <?php print_r($result); ?>
Private
[
?
]
Run code
Submit