Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function indenter($locations, $parent_id = null, $prefix = '') {
- $results = Array();
- foreach($locations as $location) {
- if($location->parent_id == $parent_id) {
- //append this parent node first,
- $location->use_text = $prefix.' '.$location->name
- $results[] = $location;
- //now append the children.
- $results = array_merge($results,indenter($locations,$location->id,$prefix.'--'));
- }
- }
- return $results;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement