func_$var() in PHP4?
| From: | Tijnema | Date: | Fri, 22 Jun 2007 13:36:55 +0000 |
| Subject: | func_$var() in PHP4? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-257641@lists.php.net to get a copy of this message | ||
Hi all,
How can I get this in PHP4?
I used this in PHP5:
<?php
class ABC
{
function func_a()
{
return "a";
}
function func_b()
{
return "b";
}
}
$abc = new ABC();
$var = a;
$result = $abc->func_$var(); // Line 17
?>
In PHP5 $result contains "a" here, but in PHP4 I get this error:
Parse error: syntax error, unexpected T_VARIABLE in /xxxx/test.php on line 17.
Does anyone know how to accomplish this with PHP4?
Thanks,
Tijnema
--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info