Title says it all.
Though the manual says you're better off to avoid a function call, I've also read $array[] is much slower than array_push(). Does anyone have any clarifications or benchmarks?
Thank you!
6
|
Title says it all. Though the manual says you're better off to avoid a function call, I've also read $array[] is much slower than array_push(). Does anyone have any clarifications or benchmarks? Thank you!
|
|||
|
17
|
No benchmarks, but I personally feel like Edit: Ran this code:
The first method using Some benchmark results:
This shouldn't be surprising, as the PHP manual notes this:
The way it is phrased I wouldn't be surprised if |
||||
|
2
|
Word on the street is that [] is faster because no overhead for the function call. Plus, no one really likes PHP's array functions... "Is it...haystack, needle....or is it needle haystack...ah, f*** it...[] = " |
||||||||||
|