after a few cup of coffee and some server errors i found a solution. it's not yet the 'best' but a start to think of how to increase the performance.
Add more values to the array just as you like to.
Attention: i didn't test it with "fixex key-value"-pairs that need to be associated! (i mean e.g. [a]=3, [d]=5 .... and the sort it)
must admit that i'm a little bit proud of that code 😉
$start_array = array("A", "B", "C");
function go($string, $del_array)
{
global $start_array;
if($del_array)
$new_array = array_diff($start_array,$del_array);
else
$new_array = $start_array;
if(sizeof($new_array)>0)
{
while(list($key,$val)=each($new_array))
{
$del_array[$key] = $val;
go($string." ".$val,$del_array);
$temp[] = $val;
$del_array = array_diff($del_array,$temp);
}
}
else echo "<b>".$string."</b><br>";
}
go("",false);