Untitled

DEVELOPED BY: HTTPS://GITHUB.COM/ILKERCETO
mail@pastecode.io avatar
unknown
php
2 years ago
1.0 kB
3
Indexable
Never
<?php
echo "<h2>Patroon I</h2>";
$rijen = 6; // Voeg rij nummers toe (hoeveel rijen je wilt)
for($inhoud = 1; $inhoud <= $rijen; ++$inhoud)
{
for($j=1; $j<=$inhoud; ++$j)
{
echo ($j."&nbsp;"); // Voegt spatie toe tussen nummers
}
echo ("<br>"); // Blanke rij
}

echo nl2br (" \n ");
echo nl2br (" \n ");

echo "<h2>Patroon II</h2>";
$rijen = 6;
for($inhoud = $rijen; $inhoud>=1; --$inhoud)
{
for($j = 1; $j<=$inhoud ; ++$j)
{
echo ($j. "&nbsp;");
}
echo ("<br>");
}

echo nl2br (" \n ");
echo nl2br (" \n ");

echo "<h2>Patroon III </h2>";
$rijen = 6;
$print = "";
for ($j = 1; $j <= $rijen; ++$j) {
  $print = $j."&nbsp". $print;;
  echo str_repeat("&nbsp;&nbsp;&nbsp;", $rijen - $j) . $print;
  echo ("<br>");
}

echo nl2br (" \n ");
echo nl2br (" \n ");

echo "<h2>Patroon IV </h2>";
$rijen = 6;
for ($i = 0; $i < $rijen; $i++) {
    for ($x = 0; $x < $i; $x++) {
        echo '&nbsp;&nbsp;&nbsp;';
    }
    
    for($x = 0; $x < $rijen-$i; $x++) {
        echo $rijen - $i - $x. "&nbsp";
        
    }
    
    echo '<br>';
}