News Feed
Jobs Feed
Sections




News Archive
phpRiot.com:
Using the PHP 5 Iterator interface with Smarty
March 10, 2008 @ 09:35:00

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.

2 comments voice your opinion now!
iterator interface smarty php5 spl object array


blog comments powered by Disqus

Similar Posts

Upcoming.org: Release of PHP API Wrapper Class

DevShed: Enforcing Object Types in PHP - Using the PHP5 instanceof Operator

DevShed: Additional Methods for Using SQLite with PHP 5

International PHP Magazine: Poll Question: Common Perspectives Regarding Objects in PHP Are?

Nefarious Designs: Object-Oriented PHP Part 1: Definition


Community Events









Don't see your event here?
Let us know!


framework language opinion unittest api functional zendframework2 composer testing example code introduction object release development event tool podcast community interview

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