note 18948 added to functions

From: Date: Mon, 11 Feb 2002 08:26:54 +0000
Subject: note 18948 added to functions
Groups: php.notes 
Request: Send a blank email to php-notes+get-26463@lists.php.net to get a copy of this message
Some people complaint about PHP's lack of function overloading (as PHP has polymorphic variables, overloading is not possible) However, a limited form of overloading can be achieved: function my_overloaded_function ($var1,$var2) { if (is_integer($var1)) { //Code for the integer version } if (is_string($var1)) { //Code for the string version } } (Instead of declaring "function my_function(int $var1)" and "function my_function(string $var2)", which is impossible) -- http://www.php.net/manual/en/functions.php http://master.php.net/manage/user-notes.php?action=edit+18948 http://master.php.net/manage/user-notes.php?action=delete+18948 http://master.php.net/manage/user-notes.php?action=reject+18948

« previous php.notes (#26463) next »