Skip to content

Instantly share code, notes, and snippets.

@sidneisimeao
Created February 21, 2022 17:04
Show Gist options
  • Save sidneisimeao/acdccae3a6a21465b2d772484b512acc to your computer and use it in GitHub Desktop.
Save sidneisimeao/acdccae3a6a21465b2d772484b512acc to your computer and use it in GitHub Desktop.
<?php
function construirEscada($degraus)
{
$escada = '';
for ($i = 0; $i < $degraus; $i++) {
$escada .= str_repeat(' ', $degraus - $i)
. str_repeat('*', $i + 1) . "\n";
}
return $escada;
}
echo construirEscada(6);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment