We know that the infinite classification of many open-source software uses recursive algorithms, but we know that recursion is a waste of time and space (memory ), last time I also shared my original method of generating tree with unlimited categories. a enthusiastic php expert gave me valuable suggestions. I tested it, this code is very short for reference: www. oschina. netcodesnippet_98719_11296, I sorted it out again and found that after the database queries the data, we have set the key value, so... we know that the infinite classification of many open-source software uses recursive algorithms, but we know that recursion is a waste of time and space (memory ), last time I also shared my original method of generating tree with unlimited categories. a enthusiastic php expert gave me valuable suggestions. I tested it, the time for this code is very short. For more information, refer to explain. As a result, the data format is displayed in the model and formatted as the corresponding data of the primary key value. Therefore, we can use this data directly, thus reducing the cycle. The code is also very concise. Original Code: function genTree ($ items, $ id = 'id', $ pid = 'pid', $ son = 'Children ') {$ tree = &
1. php unlimited classification tree data formatting code
Introduction: Time formatting code
[Related Q & A recommendations ]:
Javascript-format code with sublime3
How does one format the idea code in java-mac?
Does javascript-vscode have js formatting code plug-ins in strict mode?
How does java-jsoup disable code formatting?
Ide-phpstorm code formatting
The above is a summary of 10 tutorials related to php formatting code. For more information, see other related articles in the first PHP community!