Reply to Overloaded functions and function pointers in PHP?

Your name:

Reply:


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

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

[Back to original 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

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