PHP-64
function f($a,$b,$c){for($w='\|/';++$i<=$a;)echo$w[$c+($i>$b)];}
単純なループ、およびキャラクターのエコー。
を生成しNotice: Undefined variable: i、エラーをサイレントにする別のバージョンがあります(65文字):
function f($a,$b,$c){for($w='\|/';@++$i<=$a;)echo$w[$c+($i>$b)];}
エラーのないバージョン(69文字):
function f($a,$b,$c){for($w='\|/',$i=0;++$i<=$a;)echo$w[$c+($i>$b)];}
PHPの他の機能:
sprintf/ printfパディング
function f($a,$b,$c){printf("%'{${0*${0}=$c?'|':'\\'}}{$a}s",sprintf("%'{${0*${0}=$c?'/':'|'}}{${0*${0}=$a-$b+$c}}s",''));}
str_pad/ str_repeat関数を介したパディング
function f($a,$b,$c){$f='str_repeat';echo$f($c?'|':'\\',$b-$c).$f($c?'/':'|',$a-$b+$c);}
function f($a,$b,$c){echo str_pad(str_repeat($c?'|':'\\',$b-$c),$a,$c?'/':'|');}
printfとstr_repeat関数の両方を使用する
function f($a,$b,$c){printf("%'{${0*${0}=$c?'|':'\\'}}{$a}s",str_repeat($c?'/':'|',$a-$b+$c));}
function f($a,$b,$c){$w='\|/';printf("%'$w[$c]{$a}s",str_repeat($w[$c+1],$a-$b+$c));}