note 20796 deleted from control-structures.switch by betz
| From: | betz@php.net | Date: | Wed, 29 Mar 2006 02:28:35 +0000 |
| Subject: | note 20796 deleted from control-structures.switch by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-106898@lists.php.net to get a copy of this message | ||
Note Submitter: miket of iopenmedia dot com
----
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);
?>