note 20796 modified in control-structures.switch by vrana

From: Date: Tue, 17 Aug 2004 13:54:54 +0000
Subject: note 20796 modified in control-structures.switch by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79948@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: <?php 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: <?php $num = func_num_args() - 1; $arg{$num} = func_get_arg($num); ?> --was-- 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://php.net/manual/en/control-structures.switch.php

« previous php.notes (#79948) next »