Monday, May 27, 2013

PHP Strings Are Fast

I've recently been playing with PHP again. Last time I touched it was 2001 or there abouts.
And I found I needed a HTML-Builder (well needed to port my C# one). Being a little rusty I looked around for something like a StringBuilder and found none. Because, as most of the posts put it, PHP strings are fast enough.

Well I wasn't completely convinced, so I wrote a quick test that through a number of iterations built up 3 really big strings at the same time, and the response just came back straight away. Not to be put off I kept upping the iterations till it was getting to something absurd, when finally, I got an out of memory error. But the key point is, up till that moment, the responses were always coming back almost instantly.

So well done PHP. I find some of the language a little old fashion, but those PHP strings are lightning fast.

No comments:

Post a Comment