RE: [PHP] Re: function over loading?

2002-05-12 Thread Jason Murray

  Can you practice function over-loading in php?
 
 No you cannot overload in PHP.

You can achieve the same effect (having the same function do
something else in a different circumstance) by making
parameters optional:

?
   Function functionName($param1, $param2 = )
   {
 ...
   }
?

$param1 is required, $param2 is optional - if its not
supplied when the function is called, it will be .

J

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: function over loading?

2002-05-12 Thread Rasmus Lerdorf

Well, not in the procedural sense, but you can do method and property
overloading on objects.  See http://php.net/overload

-Rasmus

On Sun, 12 May 2002, Smileyq wrote:

 In article
 [EMAIL PROTECTED],
  [EMAIL PROTECTED] (Kris Vose) wrote:

  Can you practice function over-loading in php?
 
  Kris

 No you cannot overload in PHP.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: function over loading?

2002-05-12 Thread Miguel Cruz

On Sun, 12 May 2002, Smileyq wrote:
 [EMAIL PROTECTED] (Kris Vose) wrote:
 Can you practice function over-loading in php?

 No you cannot overload in PHP.

In a particularly masochistic project, we achieved function overloading by 
creating a global array $F that linked public to hidden names of all our 
functions. To overload, just change the hidden name.

  $F['list_items'] = 'main_list_items';

Then later, if we wanted to overload list_items, just do

  $F['list_items'] = 'substitute_list_items';

This functions would be called like:

  $F['list_items']($param1, $param2, $etc);

It worked fine but sure took some getting used to.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php