>     I'm wondering if there is an easy way to code a generic cloner at top
> level of object inheritance tree so that all descendents can follow? Or by
> nature the clone() function needs be implemented at final class
> def.? Thanks a lot!

You could probably use something like:

function clone($whatever){
    $clone = $whatever;
    if (is_object($whatever)){
        while (list($var, $val) = each($whatever)){
            $clone->$var = clone($val);
        }
    }
    elseif (is_array($whatever)){
        while (list($var, $val) = each($whatever)){
            $clone[$var] = clone($val);
        }
    }
    else{
        $clone = $whatever;
    }
    return $clone;
}

No promises this can be made to work, much less to do what you want, but it
might...

--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to