Possible Duplicate:
What exactly is late-static binding in PHP?
I would like to build an abstract class that will instantiate it's child class using a static function.
<?php
class A
{
    protected $value;
    public function __construct($value)
    {
        $this->value = $value;
    }
    public static function create($value)
    {
        /* A must not know about B! 
         * I give that example for the context understanding */
        return **new B**($value);
    }
}
class B extends A
{
}
Of course A has not to know about B.. I do not know if it is possible and I do not want to have to implement the create function in all my 170 subclasses...
Do you think I should use a Factory that would return the instance of one of my 170 classes? That is cumbersome and not very maintainable..
 
     
    