View Single Post
Old 11-14-2007, 10:50 AM   #6 (permalink)
DragonBe
The Wanderer
PHP Guru Advanced Programmer Zend Certified 
 
DragonBe's Avatar
 
Join Date: Nov 2007
Location: according to my wife: on the Net
Posts: 19
Thanks: 0
DragonBe is on a distinguished road
Default best-practice: $array[] = $item or array_push($array, $item)?

Since we talk about array_push here, I might as well ask the question here. What's better or faster ?

Code:
foreach ($complex_array as $key => $item) {
   $array[] = $item;
}
or

Code:
foreach ($complex_array as $key => $item) {
   array_push($array, $item);
}
Just a wondering of me...
Send a message via ICQ to DragonBe Send a message via Skype™ to DragonBe
DragonBe is offline  
Reply With Quote