[PHP] how do the thing?

2001-11-11 Thread Galkov Vladimir

Good time of a day!
well... as for me the construction...

switch($action)
  {
case ...
..
}

...is not very elegant when number of cases over 40-60 or more and the only
thing they must do is start one function (often with the same name). for
example:

   case 'add_user_form':
 {
  show_add_user_form();
  break;
 }

more interesting is to create txt file with records like:

add_user_formshow_add_user_form()
add_user_recoderadd_user_recoder()
...

 So read  show_add_user_form() is not a problem but how tell PHP that this
is a name of function to start but a simple text string? ...

P/S: I know about reading php manual ;-) may be in an hour or two I'll get
answer on myself but may be somebody can answer qwicker? ;-)

Thancks!
Vladimr.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] how do the thing?

2001-11-11 Thread Martin Towell

once you have read in the file and parsed it up, all you need to do then is
to find the correct string to execute and call it using :

eval($string);

happy coding
Martin T

-Original Message-
From: Galkov Vladimir [mailto:[EMAIL PROTECTED]]
Sent: Monday, November 12, 2001 4:12 PM
To: [EMAIL PROTECTED]
Subject: [PHP] how do the thing?


Good time of a day!
well... as for me the construction...

switch($action)
  {
case ...
..
}

...is not very elegant when number of cases over 40-60 or more and the only
thing they must do is start one function (often with the same name). for
example:

   case 'add_user_form':
 {
  show_add_user_form();
  break;
 }

more interesting is to create txt file with records like:

add_user_formshow_add_user_form()
add_user_recoderadd_user_recoder()
...

 So read  show_add_user_form() is not a problem but how tell PHP that this
is a name of function to start but a simple text string? ...

P/S: I know about reading php manual ;-) may be in an hour or two I'll get
answer on myself but may be somebody can answer qwicker? ;-)

Thancks!
Vladimr.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]