Anonymous user
Permutations: Difference between revisions
→{{header|PHP}}
Line 3,500:
<lang php>
//Author Gavryushin Ivan @dcc0
<?php
$b="
$a=strrev($b);
print "\n";▼
while ($a !=$b) {
$i=1;
while($a[$i] > $a[$i-1]) {
$i++;
}
$j=0;
while($a[$j] < $a[$i]) {
$j++;
}
Line 3,518 ⟶ 3,517:
$a[$j]=$a[$i];
$a[$i]=$c;
▲ print $a. "\n";
▲ $x=strrev(substr($a, 0, $i));
}
}</lang>▼
?>
'''Output'''
<pre>
|