News Feed
Sections




News Archive
feed this:

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

PHPBuilder.com:
Three Advanced Object-Oriented PHP Features You Need to Know
June 16, 2010 @ 09:13:23

On PHPBuilder.com there's a new article on OOP in PHP applications, specifically some of the things that PHP5 has to offer you if you're not using it to its fullest potential.

I'll introduce you to three of PHP's advanced object-oriented features which seem to not have garnered the attention they deserve. The topics discussed here should be useful whether you're a relative newcomer to object-oriented development and are looking to expand your knowledge, or have a background using languages such as Java or C# and are trying to learn more about what PHP has to offer.

These three things he introduces are Reflection (PHP's API for introspection of code), the SPL (Standard PHP Library) set of objects and tools and a more recent addition - late static binding.

0 comments voice your opinion now!
objectoriented oop php5 feature spl reflection latestaticbinding


Giorgio Sironi's Blog:
The dangers of Late Static Bindings
April 14, 2010 @ 07:06:41

Giorgio Sironi has a new post that warns you of the dangers that could come from the use of a technology just recently introduced to PHP - late static binding.

There's a lot of (justified) excitement about PHP 5.3 new features, such as the support of namespaces and anonymous functions. Though, some glittering capabilities of the language are definitely not gold: the goto statement is probably the most debated example, but also the long-awaited Late Static Bindings support is an hammer which may hurt your fingers...

He talks about how two of the characteristics of late static binding - the fact that it involves something being static and that there's a sort of hierarchy involved. He gives a code example of how it could be used and notes that static functions should be used sparingly since they are a more procedural way of doing things.

The post also includes a good example - an abstract Factory method - and a bad example - Active Record that doesn't evolve towards a Repository pattern being used.

0 comments voice your opinion now!
latestaticbinding danger procedural static hierarchy


Brandon Savage's Blog:
A Lesson In Static Methods And Late Static Binding
April 12, 2010 @ 11:10:51

Brandon Savage in his frustrations with the Zend Framework and the "self" keyword in PHP has written up a new post showing how you can use late static binding to work around it.

he problem is, when extended, My_Auth::getInstance() still returns an instance of Zend_Auth. The solution was to duplicate the static method in my My_Auth class, which worked properly. What did I get as a return value? Zend_Auth [...] Why didn't I get an instance of My_Auth instead of Zend_Auth? Well, that's because PHP determines the meaning of the self keyword at compile time, meaning that when you call a function that makes use of it later, you'll get whatever it's been defined to mean when it was compiled.

To remedy the situation he uses late static binding (in PHP 5.3+) by using the "static" keyword like you would use "self" to refer correctly to the current class, not the class it sees at runtime.

0 comments voice your opinion now!
static method latestaticbinding lsb method


Jordi Boggiano's Blog:
Multiton base class
December 30, 2008 @ 11:17:49

In this recent post Jordi Boggiano looks at a different sort of design pattern - a sort of extension of the Singleton pattern: Multition.

While I like the Singleton pattern every now and then, I prefer the flexibility that the Multiton potentially offers, and well it's just an extended version of the Singleton, so it's "compatible" with the Singleton model. Anyway, to the point, PHP5.3 is coming, and with Late Static Binding you can do a base Multiton (or Singleton if you insist), which wasn't possible before. Now I like this very much because you can simply extend it rather than rewriting those (few, I know, but still) lines each time.

Included in the post is an example of the design pattern showing how to create its structure in the class and use it to grab the same or unique instances (defined with an ID).

2 comments voice your opinion now!
multiton base class singleton php5 latestaticbinding lsb


PHP.net:
PHP 5.3 alpha 1 Released
August 01, 2008 @ 07:58:29

As announced on the PHP.net site today, the first alpha version of the much-anticipated PHP 5.3 has been released - PHP 5.3 alpha 1.

The PHP development team is proud to announce the first alpha release (Windows binaries will appear in the next few days) of the upcoming minor version update of PHP. The new version PHP 5.3 is expected to improve stability and performance as well as add new language syntax and extensions. Several new features have already been documented in the official documentation, others are listed on the wiki in preparation of getting documented. Please also review the NEWS file.

Among the list of new features/improvements are things like namespaces, late static binding, lambda functions, closures, support for mysqlnd and removal of support for pre-Windows 2000 systems. For more information on when the full stable version will his the web, check out the release plan.

2 comments voice your opinion now!
php5 release alpha preview namespace latestaticbinding lambda closures


Mike Lively's Blog:
Late Static Binding (LSB) forward_static_call()
April 09, 2008 @ 11:24:19

On his blog, Mike Lively has posted a look at some of the work he's been doing on patches for the late static binding functionality to be included in PHP, including an example of the updates in action.

This weekend I wrapped up a few small tests and sent the patch in and it was subsequently pushed to php 5.3 and php 6.0. Now, this is not at all the way I wanted things to work, in all honesty I think the patch is pretty hokey but unfortunately nobody really spoke up in support of the changes I wanted to make to parent:: in regards to LSB.

His example shows how to override a static method and push that new method's execution to the parent class (in two ways - safe using forward_static_call and the not so safe calling itself with a parent:: override).

0 comments voice your opinion now!
latestaticbinding php5 php6 patch safe unsafe parent forwardstaticcall


Antony Dovgal's Blog:
5.3 snapshots are available
February 28, 2008 @ 09:33:00

Antony Dovgal points out that Derick Rethans has added the snapshots for PHP 5.3 to the snaps.php.net website.

Short list of what you can find there: Namespaces, __callstatic() magic method, accessing static members through $foo::myFunc(), fully rewritten ini-parser with .htaccess-like user defined ini files for CGI/FastCGI, improved OpenSSL extension, PCRE 7.4, and other fixes and improvements that will never get into 5_2 branch.

He recommends teching throughly before the major release to find all of the bug before the general public does. Builds for both source and Windows systems have been posted.

0 comments voice your opinion now!
php5 snapshot snaps namespace latestaticbinding static pcre openssl


Mike Lively's Blog:
Late Static Binding - Changes to parent
November 26, 2007 @ 09:37:00

Mike Lively has shared some of his thoughts on the late static binding functionality that will be in the upcoming PHP 5.3 - specifically the relationships of parents and children it has.

I won't rehash all of the arguments as you can quite easily find out my full thoughts by previous posts and on that mailing list thread. To put it simply I feel that somehow there needs to be a way to call methods in a parent class without losing the ability to reference back to the original called static.

He gives an example of what he's talking about (code) and, to help further his cause he's created three patches to make it work how he'd like.

0 comments voice your opinion now!
latestaticbinding parent change child patch latestaticbinding parent change child patch


Gergely Hodicska's Blog:
What is new in PHP 5.3 - part 2 late static binding
November 15, 2007 @ 07:57:00

Gergely Hodicska has posted part two of his look at the upcoming PHP 5.3 release. In his previous post, he looked at namespacing, but in this new one he covers late static binding (mor einfo here).

In the second part we will deal with static late binding, which is a very exciting new feature in PHP 5.3 and which promise some really nifty code. :) This topic attracted attention after Zend Framework. There was a little outcry in the PHP blogosphere, that the ActiveRecord examples presented in this webcast can't work in PHP even with the version 5.2. Now with late static binding it is possible to implement this style of ActiveRecord almost correctly.

His post is an example of implementing the ActiveRecord (sort of) pattern, complete with code examples.

0 comments voice your opinion now!
php5 latestaticbinding activerecord implement php5 latestaticbinding activerecord implement


Gergely Hodicska's Blog:
What's new in PHP 5.3 - part 1 namespaces
November 14, 2007 @ 12:50:00

Gergely Hodicska has started a mini-series of posts centering about what's going to be coming in the next major release of PHP, version 5.3. The first article has been posted today focusing on one of the more popular topics - namespaces.

In my previous post I mentioned that PHP 5.3 will be released in early 2008 so I think it's just in time to talk about the features of this version. [...] The big gun features are namespaces, late static binding and mysqlnd, but there are other interesting improvements, for example __callStatic, dynamic static calls. In this part of this series we are going to analyze namespaces in detail.

Included in the post are a "before" and "after" example of namspacing in a PHP application, code examples of namespaces in action, simple porting of current PHP 5.2 applications up to 5.3 and working with __autoload and Reflection.

0 comments voice your opinion now!
namespace php5 callstatic latestaticbinding tutorial namespace php5 callstatic latestaticbinding tutorial



Community Events





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


release interview conference series introduction security community version podcast symfony library composer laravel voicesoftheelephpant artisanfiles list opinion language framework tool

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