Ever
2013 年 12 月 13 日
来个fp点的吧
<?php
function multiplication_table($max=10, $current=1, $cache_expr="", $cache_result=1, $row_sep="\n", $result=array()){
$expr = $current ===1 ? $current: "{$current} * {$cache_expr}";
$cache_result *= $current++;
$result[] = "$expr = {$cache_result}";
return $current<=$max? multiplication_table($max, $current, $expr, $cache_result, $row_sep, $result):join($row_sep, $result);
}
echo multiplication_table(10);
echo "\n";