This comment is reply for 2626 hirataka: (与えられた文字列でピラミッド). Go to thread root.
hirataka #2633(2007/08/29 15:47 GMT) [ PHP ] Rating0/0=0.00
ちょっと修正。 trim取ったり、substrの引数取ったり。
1 2 3 4 5 6 7 8
<?php function pyramid($str){ for($i=$n=strlen($str); $i>=0; $i--, $n=strlen($str)*2-$i+1) printf("% {$n}s\n", join(" ", preg_split("//", substr($str, $i)))); } pyramid("abracadabra"); ?>
Rating0/0=0.00-0+
[ reply ]
hirataka
#2633()
[
PHP
]
Rating0/0=0.00
Rating0/0=0.00-0+