News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Maarten Balliauw's Blog:
Generic arrays in PHP
October 25, 2007 @ 08:50:00

On his blog, Maarten Balliauw has an interesting new post dealing with the use of generics in PHP:

Assuming everyone knows what generics are, let's get down to business right away. PHP does not support generics or something similar, though it could be very useful in PHP development. Luckily, using some standard OO-practises, a semi-generic array can easily be created, even in multiple ways! Here's the road to PHP generics.

He shows the two ways to make generics possible - the hard way (simple inheritance and type hinting) and the more flexible way (a GenericArrayObject that extends the normal ArrayObject to make appending and validating the contents of the array simple).

1 comment voice your opinion now!
generic array arrayobject extend filter validation generic array arrayobject extend filter validation


blog comments powered by Disqus

Similar Posts

WebCheatSheet.com: Secure File Upload with PHP

Mark van der Velden's Blog: PHP Quiz part 2

Maggie Nelson's Blog: How to (and how not to) pass an array from PHP to the database

Eran Galperin's Blog: On the pitfalls of date validation with the Zend Framework

Gergely Hodicska's Blog: Extending Zend_Acl to support custom roles and resources


Community Events





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


install series introduction testing configure list unittest framework podcast code release threedevsandamaybe opinion language community symfony2 interview laravel developer refactor

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