implode vs join in php
Tuesday, July 15th, 2008This one really surprised me. I expected these functions to be faster. Both these functions allow you to convert an array into a string. implode is the opposite of explode and join allows you to join the items in an array with a ‘glue’ string. In this case the array had 100 items.
implode vs join
implode: 47.2712550163 seconds
join: 50.1287050247 seconds
Time saved: 2.85745000839 seconds; 5.70022705949%
5% doesn’t seem like all that much but 2 microseconds shouldn’t be ignored.