or call +359 (2) 421 95 89

Multiple Inheritance in PHP - a workaround

27/08/2010

It is well known that PHP doesn't offer multiple inheritance, instead it provides interfaces. Altough the interfaces are something very good they can not fully replace the multiple inheritance. Of course some people voice opinions that if you need multiple inheritance then the design of the application is wrong - this will not be covered here. Instead we will investigate what are the...

Tags: How to... PHP 5.3 PHP General Tips and Tricks

Continue reading...

Scope propagation bug in call_user_func()

11/08/2010

In the previous entry about the scope propagation when call_user_func() is used for static calls few examples were given. They all work correctly in php 5.3 (while some don’t in php 5.2 and this was the BC change). But we have found a case when the scope is not propagated even in PHP 5.3: This yields the incorrect result of: A $this is not defined $this is not defined  This means that the scope...

Tags: Bugs PHP 5.3

Continue reading...

Scope propagation in static methods and call_user_func()

28/07/2010

The entry in the backward incompatible changes says: The call_user_func() family of functions now propagate $this even if the callee is a parent class.  Lets first give some examples for PHP 5.2… starting with an ordinary static call: This example contains two odd things – the first is that a dynamic method is called statically and no errors are produced at all and the second is that $this is...

Tags: BC breaks PHP 5.3

Continue reading...

Proper singleton implementation with php 5.3

27/07/2010

PHP 5.3 permits a proper singleton implementation. But before giving any examples using the new functionality provided by PHP 5.3 lets first explore our possiblities with PHP 5.2. This is a simple example of a singleton implementation: This example works but is far from being comfortable to use because for each singleton class you will have redundant code (the get_instance() method). It would be...

Tags: How to... PHP 5.3

Continue reading...

Backward incompatible changes in php 5.3

27/07/2010

As PHP 5.3 is a major new release it could be expected to have some backward incompatible changes. Some of the changes are clearly explained in the docuemtnation, others aren't that obvious. For example this cryptic line: The call_user_func() family of functions now propagate $this even if the callee is a parent class. So in few posts we will try to clarify some: Scope propagation in static...

Tags: BC breaks PHP 5.3

Continue reading...

Powered by Guzaba | AzonMedia is the trading name of Web Studio Ltd.