Skip to main content
2 of 7
added 5 characters in body
Kevin Brown-Silva
  • 6.5k
  • 5
  • 42
  • 59

PHP, 401 392 characters:

<? $h=STDIN;function s($s,$l){return str_repeat($s,$l);}function e($s){echo $s;}$w=$h*2;$d=$h/2;$b=$h;$c=" ";e(s($c,$h/2+1)."+".s("-",$w)."+\n");for($i=1;$i<=$d;$i++,$a=--$b){e(s($c,($h/2+1)-$i)."/".s($c,$w)."/".s($c,$i-1)."|\n");}e("+".s("-",$w)."+".s($c,$d)."|\n");for($i=1;$i<=$h;$i++){e("|".s($c,$w)."|");e($a-->0?s($c,$b).($a>0?"|":"+")."\n":s($c,$h-$i)."/\n");}e("+".s("-",$w)."+\n"); ?>

I originally did this to see how short I could do this in PHP, as I knew that it would be pretty long. I'm sure it could be reduced, but not by much considering PHP doesn't have many shortcuts.

Validation:
http://codepad.viper-7.com/ftYYz9.php53

Ungolfed Version: http://codepad.viper-7.com/4D3kIA

Kevin Brown-Silva
  • 6.5k
  • 5
  • 42
  • 59