News Feed
Sections




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

DevShed:
PHP 5 Helpers Calling Methods Out of Object Scope
July 27, 2009 @ 12:38:17

In this new tutorial from DevShed today they continue their series looking at making helper classes for your applications. This time they're focusing on using methods without needing to create an object first - static methods.

The methods of the class that I [just] mentioned were declared implicitly dynamic, even though it's perfectly possible to call them statically, and the PHP engine won't raise any errors about this process. However, it would be much better to declare these methods explicitly static, thus taking advantage of the functionality offered by the text helper class without having to spawn an instance of it.

They show how to define the methods with the "static" keyword so they can be called outside of the class' scope. Code for the helper class and the code to put it to use.

0 comments voice your opinion now!
method class object scope tutorial


blog comments powered by Disqus

Similar Posts

Brian Snugg's Blog: Reverse Proxy in PHP5

DeveloperTutorials.com: Inserting An Array Into A Database

Christian Wenz's Blog: php|works/db|works 2006

ServerGrove Blog: Deployment of Symfony2 applications with Ansible

Joshua Eichorn\'s Blog: ZActiveRecord can\'t work?


Community Events

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


interview podcast voicesoftheelephpant series symfony opinion version introduction community api framework threedevsandamaybe library extension security language laravel5 laravel unittest release

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