Hi,
I've heard rumors that there are plans to take away the ability to
assign to $this in php 5. If this is true, I would like to place a vote
to keep it, as it can be very useful in conjunction with
__call()/__get()/__set() to implement run-time aggregation seamlessly
In addition, will call_user_func() support static methods before 1.0?
call_user_func('class::method', $args);
Regards,
Greg
phpDocumentor
http://www.phpdoc.org
In addition, will
call_user_func()support static methods before 1.0?
call_user_func('class::method', $args);
call_user_func(array('class','method'), $args);
Should work.
Regards,
Stefan Walk
<swalk@prp0.prp.physik.tu-darmstadt.de
Hi,
[...]
As Marcus already replied on this part and as I agree, I'll leave out
any comments:)
In addition, will
call_user_func()support static methods before 1.0?
call_user_func('class::method', $args);
This is already supported (in PHP4). Simply use array("class", "method")
for the first argument instead of array($instance, "method").
thekid@friebes:~ > php -r 'class Foo { function bar($arg) {
var_dump($arg, $this); echo "--\n"; }} call_user_func(array("Foo",
"bar"), "static"); call_user_func(array(new Foo(), "bar"),
"non-static");'
string(6) "static"
NULL
string(10) "non-static"
object(foo)(0) {
}
$this is NULL for the call via array("Foo", "bar") - meaning this method
has been called statically.
thekid@friebes:~ > php -v
PHP 4.3.1 (cli) (built: Feb 23 2003 20:37:24)
Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies
- Timm