Created
November 14, 2014 10:52
-
-
Save Sergic/cc11b08c0a030989be84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//function build tree --- recursive | |
function show_tree( &$data, $point, $str ){ | |
//reset($data); | |
$str .= " "; | |
while ( list( $index, $point_data ) = each( $data ) ){ | |
if ( $point_data[ 'parent_id' ] == $point ){ | |
echo $str.$point_data[ 'name' ].'<br>'; | |
unset( $data[ $index ] ); | |
show_tree( $data, $point_data[ 'id' ], $str ); | |
reset( $data ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment