Re: Overloaded functions and function pointers in PHP?
- From: Peter Salzman <psalzman@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 10 Sep 2005 16:45:53 +0000 (UTC)
Oli Filth <catch@xxxxxxxxxxxxxx> wrote:
> Peter Salzman said the following on 10/09/2005 17:21:
> >
> > 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
> >
>
> How about:
>
> function foo($arg)
> {
> echo "foo $arg foo\n";
> }
>
> function bar()
> {
> return "barfoo";
> }
>
> foo(bar());
The function argument seems to be executing before the call to foo is made.
In my own code, I'm getting the equivalent of:
barfoo foo foo
rather than
foo barfoo foo
Pete
.
- Follow-Ups:
- Re: Overloaded functions and function pointers in PHP?
- From: Oli Filth
- Re: Overloaded functions and function pointers in PHP?
- References:
- Overloaded functions and function pointers in PHP?
- From: Peter Salzman
- Re: Overloaded functions and function pointers in PHP?
- From: Oli Filth
- Overloaded functions and function pointers in PHP?
- Prev by Date: Are there static functions in PHP?
- Next by Date: Re: Overloaded functions and function pointers in PHP?
- Previous by thread: Re: Overloaded functions and function pointers in PHP?
- Next by thread: Re: Overloaded functions and function pointers in PHP?
- Index(es):
Relevant Pages
|