PHP 5 → 4 converter




(download as file)
<?

class MyClass {
    var $parent;
    var $children = array();

    function __construct(/*MyClass*/ $parent = null)
    {
        if ($parent !== null) {
            $this->parent = $parent;
            $parent->addChild($this);
        }
    }


    function addChild(/*MyClass*/ $child)
    {
        $this->children[] = $child;
    }

    function MyClass()  /* PHP 4 constructor */
    {
        // call php5 constructor
        $args = func_get_args();
        call_user_func_array(array(&$this, '__construct'), $args);
    }
}