You are here: Re: Overloaded functions and function pointers in PHP? « PHP Programming Language « IT news, forums, messages
Re: Overloaded functions and function pointers in PHP?

Posted by Peter Salzman on 11/15/53 11:26

Oli Filth <catch@olifilth.co.uk> 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация