Overloaded functions and function pointers in PHP?
- From: Peter Salzman <psalzman@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 10 Sep 2005 16:21:58 +0000 (UTC)
Hi all,
Since PHP is a (weakly) typed language, is it possible to overload functions
based on the type of their argument?
Also, are there function pointers in PHP?
Here's why I'm asking. Consider these two function:
function foo( $arg ) { echo "foo $arg foo\n"; }
function bar() { echo "barfoo"; }
I'd like to be able to do this:
foo('hello');
foo(&bar());
to produce this:
foo hello foo
foo barfoo foo
Is this at all possible (and convenient!) with PHP?
Thanks!
Pete
.
- Follow-Ups:
- Re: Overloaded functions and function pointers in PHP?
- From: Chung Leong
- Re: Overloaded functions and function pointers in PHP?
- From: Oli Filth
- Re: Overloaded functions and function pointers in PHP?
- Prev by Date: Re: Developing PHP under Windows - Why?
- Next by Date: Re: Overloaded functions and function pointers in PHP?
- Previous by thread: Missing authentication variables PHP_AUTH_USER etc.
- Next by thread: Re: Overloaded functions and function pointers in PHP?
- Index(es):
Relevant Pages
|