If joined with implode()
or join()
, PHP is able to better optimize that. It goes through all strings in your list, calculates the length and allocates the required space and fills the space. In comparison with the ".=" it has to constantly free()
and malloc()
the space for the string.
↧
Answer by Armin Ronacher for php: output[] w/ join vs $output .=
↧