RE: [PHP] Variable (naming them) Functions.

From: Date: Fri, 27 Apr 2001 15:08:10 +0000
Subject: RE: [PHP] Variable (naming them) Functions.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-50636@lists.php.net to get a copy of this message
no classes CAN'T solve my problem: it is an abstraction layer. called as func_hello(); I want, inside func_hello() {} declare a new function based on what happened before func_hello() was called. In other words: I of course though about classes, and there is in fact a work around, but I need to know if 'function $var($arg) { return; }' syntax exists and what it is. in the docs there's nothing being said. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) maxim@phpbeginner.com www.phpbeginner.com -----Original Message----- From: SED [mailto:sed@sed.is] Sent: Friday, April 27, 2001 9:53 PM To: Maxim Maletsky Cc: php-general@lists.php.net Subject: RE: [PHP] Variable (naming them) Functions. Why not use classes? If I understand you problem correctly, I think classes should solve your problem. Right? SED -----Original Message----- From: Maxim Maletsky [mailto:maxim.maletsky@japaninc.net] Sent: 27. apríl 2001 11:58 To: 'PHP General List. (E-mail)' Subject: [PHP] Variable (naming them) Functions. Hello everyone: I was wondering, does anyone of you know a method to declare a function (give it a name) basing on a value acquired during run time? I tried using the syntax as of a variable function call: <snip> $fname = 'hello'; function { sprintf("%s", $fname) }($arg='') { Return "I named you : $fname"; } echo $fname($fname); # no luck... function {$fname}($arg='') { .... # nope... function $fname($arg='') { .... # neither... </snip> and so on... all parse errors... Any way to do it? I am looping an array with some function names checking if a function was declared already, and if not then declare, if yes - give a different name. I also went through these bibles: http://www.php.net/manual/en/ref.funchand.php <http://www.php.net/manual/en/ref.funchand.php> but found nothing that helps. Thanks in advance, Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) maxim@phpbeginner.com <mailto:maxim@phpbeginner.com> www.phpbeginner.com <http://www.phpbeginner.com> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#50636) next »