Home  >  Article  >  Backend Development  >  PHP array_push array function_PHP tutorial

PHP array_push array function_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:41:561147browse

1.
$arr = array();
$arr[] = '';
2.
$arr = array();
array_push($arr,'');

I just did a 100,000-time loop insertion, and the result is that the first method is still faster! (Inserting numbers in a loop, 100,000 times, the first type is about 0.04 seconds, the second type is about 0.08 seconds)

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321081.htmlTechArticle1. $arr = array(); $arr[] = ''; 2. $arr = array( ); array_push($arr,''); I just did a 100,000-time loop insertion, and the result is that the first method is faster! (Loop to insert numbers, 100,000 times,...
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