r/code • • Nov 18 '19

Need some simple PHP coding explained.

So we (my class) is getting started with PHP coding and were given the task to write a program that would write the following text:

(Watch image)

For most of you this is going to be easy, but I have no clue where to begin. So i checked what the final answer is supposed to be:

<?php          $rowNumber = 10;        while( $rowNumber > 0 ) {          $columnNumber = 0;          while ( $columnNumber < $rowNumber )          {                    echo "\*";                    $columnNumber++;          }          echo "\\n";          $rowNumber--;        }?>

I just don't understand how I'm supposed to see this. Anyone got any advice for how I can practice these kinds of tasks?

0 Upvotes

6 comments sorted by

View all comments

1

u/AndreasSkole Nov 18 '19

the code is a bit of a mess because reddit makes it inline or something. Don't know how to fix.

2

u/malicart Nov 19 '19

Programming is a business of learning how to fix things, you never stop until you understand.