Home >Backend Development >PHP Tutorial >PHP regional classification sorting algorithm_PHP tutorial

PHP regional classification sorting algorithm_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:01:54989browse

Write a function to convert the data
$array = array(
0=>array("","Hebei"),
1=>array(""," Beijing"),
2=>array(0,"Baoding"),
3=>array(1,"Haidian"),
4=>array(3,"Zhongguancun" ),
5=>array(2,"Zhuozhou")
);
After processing, the return is as follows:
Hebei
-Baoding
-- Zhuozhou
Beijing
-Haidian
--Zhongguancun

Copy code The code is as follows:

function typeArray ($array){
                $con = null; na[$v[0]].$k."|" : $k."|";
                                                                                                                                                               >$v){
           $s = substr_count($v,"|"); 1]."n";
        }
               return $con;                                  



http://www.bkjia.com/PHPjc/327956.html

www.bkjia.com
true

http: //www.bkjia.com/PHPjc/327956.html

Write a function to convert the data $array = array( 0=array("","Hebei"), 1 =array("","Beijing"), 2=array(0,"Baoding"), 3=array(1,"Haidian"), 4=array(3,"Zhongguancun"), 5=array(2, "Zhuozhou") ); Process...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn