News Feed
Jobs Feed
Sections




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

Joshua Thompson's Blog:
Return to Prototype Based Programming in PHP
October 31, 2007 @ 16:38:00

Taking full advantage of the upcoming features in the PHP 5.3.x series (and in PHP6 for that matter), Joshua Thompson has come up with a way to accomplish some prototype-based programming in a PHP application:

With the implementation of the get_called_class() function in PHP, prototype based programming in PHP is possible. The new function is in both PHP5.3 and PHP6 snapshots. So, I went back to the drawing board and came up with a fully capable class. The $this keyword is usable, as well as being able to use the self, parent, and static (new with the late static binding patch) keywords.

Prototype-based programming is (basically) a method where classes aren't prebuilt. Instead they are created on the fly based on other objects and interfaces. Joshua's post is a huge code dump of a prototype class and an example of it in use, dynamically creating two methods and making the three objects available.

0 comments voice your opinion now!
prototype programming object clone interface namespace static binding prototype programming object clone interface namespace static binding


blog comments powered by Disqus

Similar Posts

Court Ewing's Blog: Organize Your Project like a Pro with PHP Namespaces

Dagfinn Reiersol's Blog: Real programming with PHP 5.3 (part 3): Links

Job Posting: HedgeCo Networks Seeks Web Design/Programming Intern (Palm Beach, FL)

PHPClasses.org: PHP Programming Award 2007 Winner - Cesar Rodas

DevShed: Accessing Attributes and Cloning Nodes with the DOM XML Extension in PHP 5


Community Events











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


framework symfony2 introduction composer component opinion install unittest series overview podcast code facebook release hack security hhvm language package application

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