function Getarrset ($arrs, $_current_index=-1)
{
Total Group
Static $_total_arr;
Total group Subscript Count
Static $_total_arr_index;
The input array length
Static $_total_count;
Temporary Patchwork array
Static $_temp_arr;
Enter the first layer of the input array, empty the static array, and initialize the input array length
if ($_current_index<0)
{
$_total_arr=array ();
$_total_arr_index=0;
$_temp_arr=array ();
$_total_count=count ($arrs)-1;
Getarrset ($arrs, 0);
}
Else
{
Looping the $_current_index layer array
foreach ($arrs [$_current_index] as $v)
{
If the array of the current loop is less than the input array length
if ($_current_index<$_total_count)
{
Puts the value of the current array loop out into a temporary array
$_temp_arr[$_current_index]= $v;
Continue looping the next array
Getarrset ($arrs, $_current_index+1);
}
If the array of the current loop equals the length of the input array (this is the last array)
else if ($_current_index==$_total_count)
{
Puts the value of the current array loop out into a temporary array
$_temp_arr[$_current_index]= $v;
Adding a temporary array to the total group
$_total_arr[$_total_arr_index]=$_temp_arr;
Total group subscript Count +1
$_total_arr_index++;
}
}
}
return $_total_arr;
}
$arr =array (
Array (' 1 '),
Array (' A ', ' B ', ' C '),
Array (' C ', ' B ', ' a '),
Array (' + ', '-', ' * ')
);
Print_r (Getarrset ($arr));
The composition permutation algorithm of PHP array content without repetition