汉诺塔php模拟输出
1 function move($n, $from, $to, $with){ 2 if($n == 1){ 3 printf('%d: %s => %s <br/>', $n, $from, $to); 4 } else { 5 move($n - 1, $from, $with, $to); 6 printf('%d: %s => %s <br/>', $n, $from, $to); 7 move($n - 1, $with, $to, $from); 8 } 9 } 10 move(8, 'A', 'B', 'T');