Home > Backend Development > PHP Tutorial > 在目录移动到另一个目录时,下面两种格式有什么区别?求解!!

在目录移动到另一个目录时,下面两种格式有什么区别?求解!!

WBOY
Release: 2016-06-23 14:18:23
Original
923 people have browsed it

移动开发 php    php 移动目录

(移动目录)
if ( !empty( $testCategoryData) ) {
$data[0] = array_shift($testCategoryData);
$data[0]['children'] = $testCategoryData;
}


 (移动用例)
$data = array();
$data[0]= $testCategoryData[0]; 
        for ( $index = 1; $index         $data[0]['children'][$index-1] = $testCategoryData[$index]; 
        } 

回复讨论(解决方案)

区别在于后者费时费力

能不能把后者for后面的处理原理给说一下,我一直用的是第一种方法,第二种是偶尔看到的,谢谢了

for ( $index = 1; $index         $data[0]['children'][$index-1] = $testCategoryData[$index]; //抄写每个元素到目标数组

领教了,谢谢。

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template