Skip to content

Instantly share code, notes, and snippets.

@benznest
Created October 28, 2018 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benznest/36a86c07d6819cee377b0bda90d85ee6 to your computer and use it in GitHub Desktop.
Save benznest/36a86c07d6819cee377b0bda90d85ee6 to your computer and use it in GitHub Desktop.
ปริ้นนาฬิกาทราย php
<?php
$rows = 10;
echo"<br>";
// Triangle A
for($i=0; $i<$rows; $i++){
for($j=$rows - $i; $j<$rows; $j++){
echo"<font color='white'>O</font>";
}
for($j=$i; $j<$rows; $j++){
echo"O";
}
for($j=$i; $j<$rows; $j++){
echo"O";
}
echo"<br>";
}
for($i=1; $i<=$rows; $i++){
for($j=$i;$j<$rows; $j++){
echo"<font color='white'>O</font>";
}
for($j=$rows - $i; $j<$rows; $j++){
echo"O";
}
for($j=$rows - $i; $j<$rows; $j++){
echo"O";
}
echo"<br>";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment