Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $prodi = [
- "TI-D3TI", "TI-D4RPL",
- "TM-D3TM", "TM-D4PM"
- ];
- $new_prodi = [];
- foreach ($prodi as $prod) {
- # prefix = TI, TM
- # postfix = D3TI...
- [$prefix, $postfix] = explode("-", $prod);
- # push postfix
- $new_prodi[$prefix][] = $postfix;
- }
- var_dump($new_prodi);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement