verifying function existance no longer works in PHP4
| From: | Ivo Jansch | Date: | Tue, 04 Jul 2000 12:22:09 +0000 |
| Subject: | verifying function existance no longer works in PHP4 | ||
| Groups: | php.migration | ||
| Request: | Send a blank email to php-migration+get-28@lists.php.net to get a copy of this message | ||
Hi,
I developed an application in PHP3, and now I want to use it under PHP4.
However one thing is broken. I didn't read anything about it in the
incompatibilities list, so I'll post it here.
This is the thing:
I want to be able to check if a class has a certain function. I usually
do this like this:
if (isset($myobj->display))
{
$myobj->display();
}
In PHP3 this works, and the function is only called if the object has a
dispay function. But in PHP4, the isset always returns false.
The above is just a simple example. I also used to do this in PHP3,
which worked:
$funcname = $name."_display";
if (isset($myobj->$funcname))
{
$myobj->$funcname(); // (variable function)
}
Is the fact that this doesn't work in PHP4 a known issue? And if it's a
feature that's no longer supported, what's the alternative?
Greetings,
Ivo
--
Ivo Jansch <ivo@ibuildings.nl>
ibuildings.nl - information technology
http://www.ibuildings.nl