Re: [PHP-GENERAL] Can I use Functional Pointer? / Javascript bracelet conflict ?
[email protected] (Lin Zhemin)
| Newsgroups | php.general |
|---|---|
| Message-ID | <[email protected]> |
Den dobry, Jan. :-)
It's really useful, what you've told me. Thanks. :-)
Thus I can do this:
function funca() { echo This is funca; }
function funcb() { echo This is funcb; }
$a = funca;
$a();
WOW! It's cool... This simpifies many of my codes.
However, there's another confusion. I know that PHP won't
initialise a derived object, but I'm worried that I'm not sure
if it's a waste of resource that I initialise the derived object
each time a deriving object needs to use some of the statistic
functions of the derived object. Like in line 9:
1 class A {
2 function A() { echo "A::constructor<br>"; }
3 function funca() { echo "A::funca<br>"; }
4 }
5
6 class B extends A {
7 function B() { echo "B::constructor<br>"; }
8 function funca() { echo "B::funca<br>"; }
9 function functry() { $fp = new A; $fp->funca(); $this->funca(); }
10 }
11
12 $a = new B;
13 $a->functry();
Is there a better solution? Thanks a lot!
Mon, 15 May 2000, la Jan Dvorak([email protected]) cusku di'e
> You can make a call with variable name:
>
> $fname = "do_this_and_that";
> $retval = $fname ( $args );
--
¥Í¦º«´Áï¡A»P¤l¦¨»¡¡F°õ¤l¤§¤â¡A»P¤l°º¦Ñ¡C
Fingerprint20 = CE32 D237 02C0 FE31 FEA9 B858 DE8F AE2D D810 F2D9