 | News Feed |
Sections
Community Events
Don't see your event here? Let us know!
|
| feed this: |  |
Etienne Kneuss' Blog: SplFastArray to speed up your PHP arrays
posted Monday June 09, 2008 @ 12:54:04
voice your opinion now!
BY CHRIS CORNUTT
Etienne Kneuss has posted about a new part of the Standard PHP Library that creates arrays that are up to thirty percent faster than normal methods - SplFastArray.
Antony got the idea to implement a C-like array wrapper in SPL: SplFastArray. The main advantage of that class is performance, it's indeed faster than PHP arrays. How so? No free lunch: The speedup comes from the fact that non-numeric indexes are not allowed and that the array is of fixed size.
The code sample shows the setting of the size for the array (and changing it) with a var_dump of the output result. This method is always faster than normal arrays, it just varies how much from system to system (anywhere from ten to thirty percent).
tagged with: spl splfastarray set size speed faster
Etienne Kneuss' Blog: SPL Datastructures updated
posted Tuesday May 13, 2008 @ 09:31:24
voice your opinion now!
BY CHRIS CORNUTT
Etienne Kneuss has posted about some updates to the data structures functionality in the Standard PHP Library (SPL), specifically some new additions.
There finally is documentation for SplDoublyLinkedList, SplStack and SplQueue and some "new" classes: SplHeap (abstract), SplMaxHeap, SplMinHeap and SplPriorityQueue, documentation of those classes is in progress.
An example of the new functionality (for SplPriorityQueue) is included in the post showing the insertion of a value into a pre-existing array (without having to slice or splice!).
tagged with: spl standardphplibrary datastructure heap priorityqueue
Developer Tutorials Blog: Iterating PHP objects, and readable code too!
posted Tuesday May 06, 2008 @ 14:34:58
voice your opinion now!
BY CHRIS CORNUTT
The Developer Tutorials blog has a recent post that talks about manipulating objects in PHP with the help of the iterators that the Standard PHP Library has to offer.
It's a generally accepted fact that more readable code is more maintainable and easier for other developers to pick up. [...] Today I'm going to take a look at object iteration, most commonly found in the Standard PHP Library, and explore using the Iterator interface to simplify looping.
The main part of the tutorial shows how to implement the Iterator interface of the SPL to create your own custom methods, theirs being a Database version with methodsfor rewinding, reading and getting the current record you're working with.
tagged with: spl iterator tutorial database implement
Marco Tabini's Blog: 5 PHP 5 features you can't afford to ignore
posted Tuesday April 29, 2008 @ 17:06:45
voice your opinion now!
BY CHRIS CORNUTT
Marco Tabini has posted his list of what he considers five features of PHP5 that you "can't afford to ignore" when doing your development work:
Despite the fact that you may not have a choice in the matter, upgrading comes with a number of bonus new features that can help you write better code and gain access to new functionality that required a fair amount of hacking in previous version. Here's a quick list of 5 personal favourites.
The feature to make his list are SimpleXML, JSON/SOAP, PDO, the Standard PHP Library and SQLite. Each has their own bonus feature(s) included too for a little extra incentive to check them out.
tagged with: php5 feature list ignore simplexml json soap pdo spl sqlite
Make Me Pulse Blog: PHP6, Unicode and TextIterator features
posted Friday March 14, 2008 @ 09:32:34
voice your opinion now!
BY CHRIS CORNUTT
On the Make Me Pulse blog, there's a look at PHP6's support of Unicode in the SPL (Standard PHP Library) TextIterator handler.
I've just install the last version of PHP6 dev and I've decided to test the famous new feature, the PHP Unicode Support. I will not explain new things about PHP6 or Unicode or TextIterator, it's just my discoveries test on this features.
He steps through the process he followed - enabling Unicode support, testing various output methods (including just an echo and using the TextIterator) as well as some of the manipulation methods (next/first/current) that can be used to get certain characters out of a string.
tagged with: php6 unicode textiterator spl standard php library enable
phpRiot.com: Using the PHP 5 Iterator interface with Smarty
posted Monday March 10, 2008 @ 09:35:00
voice your opinion now!
BY CHRIS CORNUTT
On the phpRiot blog, Quentin Zervaas has posted a quick tutorial about using the Iterator interface (part of the Standard PHP Library) together with Smarty to loop through some objects:
The PHP 5 Iterator interface is very useful for defining custom behaviour for looping over objects, however I just noticed that looping over such objects in Smarty will not work correctly. Smarty will in fact cast an object back to an array.
He includes code examples of his problem to illustrate and shows how he got around the problem - a getData() function he defined that just returns the array from the object.
tagged with: iterator interface smarty php5 spl object array
|