Re: variable method names
| From: | Kendrick Vargas | Date: | Wed, 14 Feb 2001 06:11:17 +0000 |
| Subject: | Re: variable method names | ||
| References: | 1 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-1339@lists.php.net to get a copy of this message | ||
On Wed, 14 Feb 2001, Chuck Hagenbuch wrote:
> Quoting Kendrick Vargas <ken@hudat.com>:
>
> > when I tried it originally (some pre-release version of 4.0) it didn't
> > work. As for the syntax, I'm not a school-educated programmer, so I'm not
> > sure what would be correct :-)
>
> This works fine for me:
>
> <?php
>
> error_reporting(E_ALL);
>
> class dynamic {
>
> function dynamic($string)
> {
> $this->$string();
> }
Oh, I never said it didn't work now! I said it didn't work when I
originally needed it. I just wanted to know if there was a prefered way to
write it:
$this->$method($value);
or
$this->{$method}($value);
:-)
-peace
--- BEGIN GEEK CODE BLOCK ----------+----------
GAT d- s:+ !a C++$ UL/S/I/B++++$ P+ | "In the ongoing battle between objects
L++ E- W+(+++) N K- w(---) O-- M@ | made of aluminum going hundreds of
V(--) PS+++ PE Y+ PGP@ t++ 5 X+ R- | miles per hour and the ground going
tv+ b- DI++++ D+(+++) G e>++ h--- | zero, the ground has yet to lose."
r++ z+>+++ - END GEEK CODE BLOCK ---+