Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $cont = file_get_contents('catz.txt');
- $cont = explode("\n", $cont);
- $cats = array();
- foreach ($cont as $line)
- {
- $temp = explode(":", $line);
- $maincat = $temp[0];
- $temp2 = explode(" => ", $temp[1]);
- $subcat = $temp2[0];
- $catid = $temp2[1];
- $cats[$maincat] = array();
- }
- foreach ($cont as $line)
- {
- $temp = explode(":", $line);
- $maincat = $temp[0];
- $temp2 = explode(" => ", $temp[1]);
- $subcat = $temp2[0];
- $catid = $temp2[1];
- $cats[$maincat][$subcat] = $catid;
- }
- print_r($cats);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment