News Feed
Sections




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

Martynas Jusevicius' Blog:
Method overloading in PHP 5
December 02, 2008 @ 10:28:50

Martynas Jusevicius has a new post looking at method overloading in PHP5 - a workaround to make it possible at least.

Method overloading (a feature of object-oriented programing which allows having several class methods with the same name but different signatures) is not implemented in PHP, which is a drawback compared to Java. However, PHP 5 provides a way to imitate overloading by catching calls to "inaccessible methods" with magic method __call.

In his example he uses __call to route the request to the correct version of the constructor (__construct0 or __construct1) based on the number of arguments passed in

0 comments voice your opinion now!
method overload php5 construct call magic function route


blog comments powered by Disqus

Similar Posts

Elijah Horton: Sandboxing Untrusted Code With PHPSandbox

Think Vitamin Blog: Getting Started with OOP & PHP5: Part 2

Symfony Blog: New in symfony 1.2: Toward a RESTful architecture (Part 1)

PHP-Coding-Practices.com: How Table Migrations In CakePHP 1.2 Can Save Your Life

Davey Shafik's Blog: ZCEGuide.com Deadline Fast Approaching


Community Events





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


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

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