 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
SitePoint PHP Blog: High-Performance String Concatenation in PHP
by Chris Cornutt 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.
voice your opinion now!
performance append string concatenation optimize
Matthew Weier O'Phinney's Blog: From the inside-out How to layer decorators
by Chris Cornutt April 07, 2009 @ 09:35:53
Matthew Weier O'Phinney has posted the second part of his look at decorators in Zend Framework applications. This time he shows the process behind using multiple decorators to alter the same content pushed through each, one after the other.
You may have noticed in the previous installment that the decorator's render() method takes a single argument, $content. This is expected to be a string. render() will then take this string and decide to either replace it, append to it, or prepend it. This allows you to have a chain of decorators -- which allows you to create decorators that render only a subset of the element's metadata, and then layer these decorators to build the full markup for the element.
He gives the example of a custom form element (as was created in the previous part) and how to split it out into two different parts - one object for the main input element and the other to alter the object and add a label. He mentions overcoming a few issues like appending content instead of overwriting, controlling the order they run in and marking where to add the new content to the content of the object.
voice your opinion now!
form decorator tutorial zendframework append content designpattern
Havard Eide's Blog: Iterators
by Chris Cornutt August 06, 2008 @ 12:52:35
Havard Eide looks at another aspect of the Standard PHP Library in a new blog post today - iterators.
[It's] a set of classes in the SPL that implements various iterating patterns: ArrayIterator, AppendIterator, FilterIterator, LimitIterator and NoRewindIterator. Hopefully you'll get a idea of what these are capable of and that you can get some new ideas for your day-to-day tasks.
He breaks it down into example of each, explaining what they can be used for, how they work and a code example of each in action (with output). You can find more information in iterators and their functions in the SPL section of the manual.
voice your opinion now!
iterator tutorial array append filter limit norewind
Stoyan Stefanov's Blog: JS/PHP string concatenation mistype
by Chris Cornutt October 31, 2007 @ 12:04:00
"Cross-over" developers out there (those that use PHP and Javascript on a regular basis) can sometimes get confused by little syntax things. Stoyan Stefanov got tripped up by just such an issue.
The front-end developer is a strange beast who has to jiggle to and fro and code in several languages literally at the same time - javascript, html, css, php or some other server side language, some SQL dialect... No wonder that sometimes we make silly mistakes.
His issue was with appending - in Javascript, it's a plus but in PHP, it's a period. Unfortunately, the problem can be hard to track down since Javascript also has a use for the period operator - treating the preceding thing like an object.
voice your opinion now!
concatenation syntax javascript append concatenation syntax javascript append
Ibzi's Blog: Start caching all your pages in 5 steps
by Chris Cornutt February 19, 2007 @ 10:12:00
On ibzi's blog today, there's a quick guide to introducing caching to your PHP application via a simple PHP file to create the cached pages.
Caching your pages can be pretty useful, especially if you have PHP-generated pages that uses a lot of MySQL queries. Once your pages are cached, your server won't waste speed and RAM on regenerating the pages, it will just load it from the cache. I'm going to show you how to get PHP to cache your pages, and you can probably do this within 5 minutes.
You'll need to be able to add (and use) an .htaccess file for Apache to use this method, but once it's set up, the simple script works like a charm. It prepends the caching functionality to each page and checks to see if a copy already exists. If it does, it displays it and if not, it will display it and create the cached file.
voice your opinion now!
cache application simple tutorial apache htaccess prepend append cache application simple tutorial apache htaccess prepend append
Jacob Santos' Blog: My Love For Array Object Idiocy
by Chris Cornutt August 04, 2006 @ 06:24:51
In his latest blog entry, Jacob Santos looks at objects and his seeming faciation with every little thing they do - specifically the Array objects.
I suppose I'm fixated on objects, but damn it, they are awesome. Recently, I've been thinking of creating a framework that takes array and file functions and creates a class wrapper around them. It would have been nice if PHP offered an object for handling Arrays and Files. SPL does manage some sorting for arrays, but I would like to fully manage arrays through the internal Array methods.
He dives deeper into the Array objects, looking at how to use them, appending them to each other, how much overhead making the object causes (testing), and the results of those tests.
voice your opinion now!
array object spl append use testing userland results array object spl append use testing userland results
|
Community Events
Don't see your event here? Let us know!
|