Reply to Re: string concat vs. join/implode

Your name:

Reply:


Posted by Toby A Inkster on 05/14/07 21:36

NoWhereMan wrote:

> well IIRC I read something about using .join() instead of += in a guide
> about optimizing JavaScript (this applies to Java as well, though); I
> thought it could be applied to PHP too.

The way Javascript deals with strings is entirely different to the way PHP
does. In Javascript, strings are an immutable object, so the += operator
doesn't just concatenate one new string onto an existing string object --
it creates a brand new string object then reassigns the old string object
variable to point to the new object, marking the old object for garbage
collection.

--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация