Re: [PHP-PEAR] variable method names
[email protected] (Chuck Hagenbuch)
| Newsgroups | php.pear |
|---|---|
| Message-ID | <[email protected]> |
Quoting Kendrick Vargas <[email protected]>: > 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(); } function foo() { echo 'foo'; } function bar() { echo 'bar'; } } $f = new dynamic('foo'); $b = new dynamic('bar'); ?> php 4.0.5-dev. -chuck -- Charles Hagenbuch, <[email protected]> "My intuitive grasp of math often leads me astray." -Me