News Feed
Sections
News Archive


Community Events






feed this:

Mike Lively's Blog:
Late Static Binding (LSB) forward_static_call()
0 comments :: posted Wednesday April 09, 2008 @ 11:24:19
voice your opinion now!

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).

tagged with: latestaticbinding php5 php6 patch safe unsafe parent forwardstaticcall


Arnold Daniels' Blog:
A dark corner of PHP class casting
0 comments :: posted Wednesday February 20, 2008 @ 12:08:00
voice your opinion now!

In this blog entry Arnold Daniels talks about an issue he had in the past (needing a bit more functionality than the PEAR DB library could offer) and how he ended up solving it with what he calls a "dark corner" of PHP - class casting.

PHP has a function serialize, which can create a hash from any type of variable, scalars, array, but objects as well. Using the unserialize function, PHP can recreate the variable from the serialized hashed. If we look at how an object is serialized, we see only the properties and the class name are stored.

His method allows for class manipulation via changes to the serialized class information (like changing the value of the name parameter). His "casttoclass()" function makes changing this value simple.

tagged with: class casting serialize extend parent child


PEAR book zend application package ajax code PHP5 developer database release cakephp releases zendframework framework security job mysql conference pecl

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