Thank You for the answer and the link. I'm not sure that I want to start OOP-ing in my php code, but I will if necessary.
I'l tell the problem I want to solve. It also will help me to understand the problem: There are two (or more) different functions on my web site, that have the same name (an action). They are called depending on the permittions of the end user. (for example, if it is an unregistered user, then it is redirected to registration form, if it is a registered user, some table is generated from database, if it a administrator user, some additional controls a shown that allow to change the table). I want to have the code clean so I don't want to put the switch or if operators to it. I will call the wrapper that will check the grant of the user and call apropriate function. (For example: Load_action("List")) So there is a set of grant properties assigned to each function and a list (array, whatever) of such functions is assigned to the action. The wrapper walks through the list and finds the first function which grant properties match the user grant properties. The second side is that I want to make the coding very easy and simple. So if I want don't want to bother with the name of the functions a write for the action. I want to write the function, and call some method that accepts action name and a permission set as an argument (permission set will be a string that will be evaluted by the wrapper), for example : Add_function_to_container("List","(P_READ AND P_WRITE) OR P_ADMIN","Some kind of description of this function"); This method adds the copy of function to array then deletes the original function, so I can use the same function name next time. (For simplicity, the function names is always the same as the action name, so it always knows which function to add) This will also simplify the process of writing developers documentation. So, this doesn't work in PHP. There are several solutions: 1. I wouldn't be so lazy and will make another function name. For example if there is an action called List, then there will be following functions: function Action_List_1() function Action_List_2() function Action_List_3() The wrapper then looks up for the new function with the help of get_defined_functions() and adds the Action_List_...() function that is still not in the list. 2. I will make same kind of an abstract class called the same way as action and there will be derived classes that implement the functions. This sounds nice but a little bit cumbersome. There will be 200 actions and I don't want to write an abstract class for each of them.This contradicts my philosophy of lazyness. 3. Some great idea that You will provide. Maybe based on OOP, maybe not, but it is easy to code and perfect. Have a nice day. Dimi. ----- Original Message ----- From: "Adam Bregenzer" <[EMAIL PROTECTED]> To: "Sztankó Demeter" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, February 21, 2004 7:13 PM Subject: Re: [PHP] delete a function > I'm not completely sure what your intended use of the process you > described is, but it sounds to me like you are trying to implement the > factory pattern[1]. I would recommend looking into using classes in PHP > and giving it a shot. > > http://www.phppatterns.com/index.php/article/articleview/49/1/1/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php