Skip to main content
Commonmark migration
Source Link

##PHP, 117 bytes

PHP, 117 bytes

<?$n=$argv[1];$r=str_repeat;echo$r("/\\",$n);for(;$i++<$n*2-1;)echo"\n".($i%2?"\\":'').$r("/ ",$n-floor(($i-1)/2));?>

Assumes notices are turned off and input is taken from command line.

Ungolfed:

<?php
error_reporting(E_ALL & ~E_NOTICE);

$n = $argv[1];
$r='str_repeat';
echo $r("/\\",$n);
for(;$i++<$n*2-1;){
    echo"\n".(($i%2)?"\\":'') . $r("/ ",$n-floor(($i-1)/2));
}
?>

Comments are welcome :)

##PHP, 117 bytes

<?$n=$argv[1];$r=str_repeat;echo$r("/\\",$n);for(;$i++<$n*2-1;)echo"\n".($i%2?"\\":'').$r("/ ",$n-floor(($i-1)/2));?>

Assumes notices are turned off and input is taken from command line.

Ungolfed:

<?php
error_reporting(E_ALL & ~E_NOTICE);

$n = $argv[1];
$r='str_repeat';
echo $r("/\\",$n);
for(;$i++<$n*2-1;){
    echo"\n".(($i%2)?"\\":'') . $r("/ ",$n-floor(($i-1)/2));
}
?>

Comments are welcome :)

PHP, 117 bytes

<?$n=$argv[1];$r=str_repeat;echo$r("/\\",$n);for(;$i++<$n*2-1;)echo"\n".($i%2?"\\":'').$r("/ ",$n-floor(($i-1)/2));?>

Assumes notices are turned off and input is taken from command line.

Ungolfed:

<?php
error_reporting(E_ALL & ~E_NOTICE);

$n = $argv[1];
$r='str_repeat';
echo $r("/\\",$n);
for(;$i++<$n*2-1;){
    echo"\n".(($i%2)?"\\":'') . $r("/ ",$n-floor(($i-1)/2));
}
?>

Comments are welcome :)

Source Link

##PHP, 117 bytes

<?$n=$argv[1];$r=str_repeat;echo$r("/\\",$n);for(;$i++<$n*2-1;)echo"\n".($i%2?"\\":'').$r("/ ",$n-floor(($i-1)/2));?>

Assumes notices are turned off and input is taken from command line.

Ungolfed:

<?php
error_reporting(E_ALL & ~E_NOTICE);

$n = $argv[1];
$r='str_repeat';
echo $r("/\\",$n);
for(;$i++<$n*2-1;){
    echo"\n".(($i%2)?"\\":'') . $r("/ ",$n-floor(($i-1)/2));
}
?>

Comments are welcome :)