Re: [PHP] Calling parent function with call_user_func_array



Tommy Baggett wrote:
I'm a self-confessed PHP newb (first step towards a cure, right?), so

if these are your first steps why use php4? php5 has been out for
going on 3 years.

apologies in advance for what may be a basic question. I spent an hour
searching for an answer to this and couldn't find one.

I found one post that said there was a problem with this in 5.0.3, but
it didn't indicate whether the fix was also applied to the PHP4 branch.

I'm using PHP v4.4.7. I have class B which extends class A. I'm
overriding a function that is normally called with a variable number of
parameters via call_user_func_array. How do I call the class A
implementation of the function using call_user_func_array from the class
B implementation?

class A {
function doSomething($elements, $level) {
...
}
}

Class B extends A {
function doSomething($elements, $level) {
...
call_user_func_array(/*class A implementation of doSomething*/,
args);

does this work:?

call_user_func_array(array(parent,'doSomething'),$args);

it's an educated guess, no garantees.

}
}

Thanks in advance for any help!

.



Relevant Pages

  • Re: [PHP] PHP4 vs PHP5 Performance?
    ... in PHP4 that was then duplicated b internal code in PHP5. ... PHP4 AND PHP5 developers don't even use OOP. ... in a pre-existing PHP encoded database abstraction layer. ...
    (php.general)
  • Re: [PHP] PHP4 vs PHP5 Performance?
    ... PHP5 being faster than PHP4 is greatly dependent on what features you ... I've consistently found PHP4 to be faster for my purposes also. ... I've been doing a lot of benchmarking with Apache to compare ... Also PHP on Apache1 was much faster than on Apache2. ...
    (php.general)
  • Suggestion for porting function to PHP5??
    ... called DBConn (this is the PHP5 ported definition for the members, PHP4 ... private $bConnected; //db link status ... escape_string function connection when necessary. ...
    (comp.lang.php)
  • Re: [PHP] Why PHP4?
    ... lot of mistakes were made when php5 came out but how can a language grow up ... I still think PHP is moving the right way. ... But at work we are stuck with some small legacy applications. ... And some major applications written on top of PHP4. ...
    (php.general)
  • Re: Speed of PHP5, making PHP faster in general
    ... There were NO database queries or anything of the sort ... We used the latest php5 beta for this ... php4 - this really makes it unusable for us. ... >> number of objects were created and and members were accessed, and php ...
    (comp.lang.php)