note 20796 added to control-structures.switch

From: Date: Tue, 16 Apr 2002 16:05:21 +0000
Subject: note 20796 added to control-structures.switch
Groups: php.notes 
Request: Send a blank email to php-notes+get-29438@lists.php.net to get a copy of this message
In Response To: ---------------------- joe@-SPAM-modjeski.net 20-Jul-2000 08:39 Just my 2 bits. Now that PHP4 supports variable function arguments, based on example 2 you should be able to assign vars like this: switch (func_num_args()){ case 3: $arg2 = func_get_arg(2); case 2: $arg1 = func_get_arg(1); case 1: $arg0 = func_get_arg(0); break; } --------------------- Why not just do: $num = func_num_args() - 1; $arg{$num} = func_get_arg($num); -- http://www.php.net/manual/en/control-structures.switch.php http://master.php.net/manage/user-notes.php?action=edit+20796 http://master.php.net/manage/user-notes.php?action=delete+20796 http://master.php.net/manage/user-notes.php?action=reject+20796

« previous php.notes (#29438) next »