News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
High-Performance String Concatenation in PHP
October 05, 2010 @ 12:08:08

On the SitePoint PHP Blog there's a new post today looking at performance in string concatenation where they compare some of the different methods for appending values and which might give you that minute edge.

This could be a more important to your application: large string operations are often handled on the server when generating HTML pages. There are no special libraries in the standard PHP installation and string concatenation is implemented using the dot operator. [...] You can also join an array of strings using the implode function.

In order to simulate a larger set of string concatenations, they create a loop of 30,000 and append a simple string - "String concatenation." - each time. One method uses the standard period append method and the other uses implode after appending to an array. The result of their testing is that the array/implode method takes twice as long as the standard period/append operator. Take into account, however, that for most applications, the performance difference will be so small, it wouldn't be noticed.

0 comments voice your opinion now!
performance append string concatenation optimize


blog comments powered by Disqus

Similar Posts

Matt Knight's Blog: Optimising Zend_Config

Christopher Jones' Blog: Statement caching bug fix to improve performance of OCI8 extension

Joakim Nygard's Blog: Optimizing PHP Through Habits

rooJSolutions Blog: Watch-out PHP 5.3.7+ is about.. and the is_a() / __autoload() mess.

Bard Farstad's Blog: Optimizing PHP for Intel based Mac


Community Events

Don't see your event here?
Let us know!


list podcast project laravel api symfony yii2 php7 programming application language part2 community example opinion composer introduction series framework interview

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework