News Feed
Sections




News Archive
feed this:

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


Matthew Weier O'Phinney's Blog:
From the inside-out How to layer decorators
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.

0 comments voice your opinion now!
form decorator tutorial zendframework append content designpattern


Matthew Turland's Blog:
Zend_Form and Zend_Loader_PluginLoader SNAFU
April 03, 2009 @ 08:47:36

Matthew Turland has ammended a previous technique he suggested about using a centralized set of plugin loaders for Zend_Form elements (part of the Zend Framework) because of an issue it can cause with the Zend_Loader_Plugin.

The bug entails Zend_Loader_PluginLoader allowing multiple instances of the same path to be added per prefix. This becomes an issue because of how Zend_Form handles adding subforms. [...] If both the form and subform are using the same plugin loaders, the bug causes the same paths to be added multiple times.

As of the posting of this article, the issue has not been corrected. The solution is outlined in the description of the bug if you want to correct the problem yourself until the full patch is included.

0 comments voice your opinion now!
zendform zendloaderpluginloader snafu bug append path fix


Havard Eide's Blog:
Iterators
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.

0 comments voice your opinion now!
iterator tutorial array append filter limit norewind


Stoyan Stefanov's Blog:
JS/PHP string concatenation mistype
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.

0 comments voice your opinion now!
concatenation syntax javascript append concatenation syntax javascript append


Ibzi's Blog:
Start caching all your pages in 5 steps
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.

2 comments 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
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.

0 comments 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!


api release package series community laravel introduction list deployment opinion interview install language zendserver library symfony tips update framework podcast

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