News Feed
Sections
News Archive


Community Events
php|tek 2008 PHP Conference



phpRiot.com:
Using the PHP 5 Iterator interface with Smarty
0 comments :: posted Monday March 10, 2008 @ 09:35:00
voice your opinion now!

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



releases zend PEAR mysql code PHP5 job package pecl book developer application framework release ajax cakephp conference zendframework security database

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