no sie postaralem i dotarlem tu z kodem...
tylko musze go jeszcze odczytac... i hate kafejki ..

) ktore nie maja total commandera
[php:1:f7565c3faa]<?php
class lusterko
{
function lustro($el)
{
$ile = count($el);
for ($i=0;$i<$ile;$i++)
{
$el[$i+$ile]=strrev($el[$i]);
}
return $el;
}
}
class silnia
{
function licz($i)
{
if ($i==0) {return 1;}
else {return $i * $this->licz($i-1);}
}
}
class permut
{
function perm($b,$element)
{
$el = $this ->przebieg($b,$element);
$lus = new lusterko;
$el = $lus ->lustro($el);
return $el;
}
function zamien($napis,$ktory)
{
if ($ktory ==0)
{
$napis1=$napis[$ktory+1].$napis[$ktory];
if (strlen($napis)>$ktory+1)
{
$napis1.=substr($napis,2,strlen($napis)-1);
}
}
if (($ktory >0) and ($ktory<strlen($napis)))
{
$napis1=substr($napis,0,$ktory).$napis[$ktory+1].$napis[$ktory];
if (strlen($napis)>$ktory+1)
{
$napis1.=substr($napis,$ktory+2,strlen($napis)-$ktory);
}
}
return $napis1;
}
function przebieg($b,$element)
{
$silnia = new silnia;
$ile_razy = $silnia ->licz($

/2;
$mniej = $b-1;
if ($mniej>1) {$element=$this ->przebieg($mniej,$element);}
$pierwszy = count($element);
for ($i=0;$i<$pierwszy;$i++)
{$el[$i].=$element[$i].$b;$c++;}
if ($mniej==1) {$el[$i] = $this ->zamien($el[0],0);}
if ($mniej!=1)
{
$gdzie =$mniej;
for ($i;$i<$ile_razy;$i++)
{
if($i%$pierwszy==0) {$gdzie -=1;}
$el[$c] = $this->zamien($el[$c-$mniej],$gdzie);
$c++;
}
}
return $el;
}
}
$permutacja = new permut;
$sila = new silnia;
$ile = 4;
$el = $permutacja -> perm($ile,"1");
if ($ile<7){ while(list($k,$l)=each($el))
{$k++;
echo "nr.$k element: $l<br>";
}}
else {echo "Elementow w tablicy: ".count($el);}
?>[/php:1:f7565c3faa]
to jest kod, klasy silnia i lusterko powiny byc w klasie permutacji ale to tylko drobiazg... podalem takze przyklad wywolania.