Re: Get name of extending class with static method call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Jason Barnett" <jason.barnett@xxxxxxxxxxxxx> wrote in message
news:20050111192629.21621.qmail@xxxxxxxxxxxxxxx
> The only other solution that comes to mind is a little messy but it lets
> you get away with no object.  Instead of calling the method statically
> you can use call_user_func_array() with the child class name as a
> parameter.  Then change the parent method to accept the child class name
> as a parameter.
>
> <?php
>
> function call_static_child() {
>    $drive_args = func_get_args();
>    /** assume that first parameter is child of class Car */
>    return call_user_func_array(array($drive_args[0], 'drive'),
$drive_args);
> }
>
> ?>

Hi Jason,

thanks for taking a look but there *must* be a way to achieve this without
passing any parameters around. Otherwise I could just do:

Porsche::drive('Porsche');

Best regards, Torsten

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux