Hi,
I've just finished implementing use for functions. This patch is
against PHP_5_3 and can be easily ported to HEAD. I am confident that
it is quite mature and have tests in the patch to prove it.
the patch is also at http://pear.php.net/~greg/usefunctions.patch.txt
This patch implements the following syntax:
func.inc:
<?php
namespace foo;
function hi()
{
echo "hi\n";
}
?>
main.php:
<?php
include 'func.inc';
use foo::hi, foo:hi as there;
foo::hi();
hi();
there();
?>
The output is "hi\nhi\nhi\n"
It can be used to alias any function, and so can also be useful for
overriding an internal function and saving it:
<?php
namespace foo;
include 'another.inc';
use function::strlen as old_strlen, function::another::strlen;
?>
With this patch, function users should be a lot happier.
Thanks,
Greg