verifying function existance no longer works in PHP4
[email protected] (Ivo Jansch) Tue, 04 Jul 2000 14:22:09 +0200
| Newsgroups | php.migration |
|---|---|
| Organization | http://www.ibuildings.nl |
| Message-ID | <[email protected]> |
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 <[email protected]>
ibuildings.nl - information technology
http://www.ibuildings.nl