why no create_method ?
| From: | Crawley | Date: | Mon, 18 Feb 2002 20:34:26 +0000 |
| Subject: | why no create_method ? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-85283@lists.php.net to get a copy of this message | ||
Is there anyway to create a class method, I want to return an object which
has a number of 'runtime' methods.
What I want to do is parse a WSDL and generate an interface object ( with
the correct functions ), the way I see it I cant do this as we lack a
create_method call. I can parse the WSDL and build a class, but I then have
to require the class. I dont want to do that though as its more of a static
language way of doing things.
The closest Ive come is this....
class base_obj
{
};
$o = new base_obj;
$o->method_1 = create_function( '$str', 'echo( $str );' );
unfortunatly you cant call
$o->method_1( "hello world" );
you have to do
$tmp = $o->method_1;
$tmp( "hello world" );
Am I missing something or is it imposible to do what I want.
Rich