|
Hello to all, i hope someone can help me, because i know our forum is great:
Hello to all mates, i am new in learning PHP and it has passed 2 weeks of my learning. I have read many posts here on forum, and i was very fond of this, it helped me to understant the basic core and i hope i will put my learning on my bigeer level. And now i have try to make a self some good taskt to keep self undertanding PHP, here is the one task i have made for myself, and there i got a problem, i can not make it, i have trying and trying, but no result, then i need help. Here is my code:
<?php $x=20; $y=20; for($i=0;$i<$y;$i++) { for($u=0;$u<$x;$u++) { if ($u<$x-1 && $i<$y-1 && $i<$u && $i>0) echo "5"; else if($u>0 && $u<$x-1 && $i>0 && $i<$y-1) echo "2"; else echo "3"; } echo "<br />"; } ?>
When i do this i got the result:
33333333333333333333 32555555555555555553 32255555555555555553 32225555555555555553 32222555555555555553 32222255555555555553 32222225555555555553 32222222555555555553 32222222255555555553 32222222225555555553 32222222222555555553 32222222222255555553 32222222222225555553 32222222222222555553 32222222222222255553 32222222222222225553 32222222222222222553 32222222222222222253 32222222222222222223 33333333333333333333
This me for learing the "for" command, everything is ok, but i really want he result to look like this:
33333333333333333333 32555555555555555553 35255555555555555553 35525555555555555553 35552555555555555553 35555255555555555553 35555525555555555553 35555552555555555553 35555555255555555553 35555555525555555553 35555555552555555553 35555555555255555553 35555555555525555553 35555555555552555553 35555555555555255553 35555555555555525553 35555555555555552553 35555555555555555253 35555555555555555523 33333333333333333333
Only number "2" on diagonale.I have tried many ways, but i got no results, can somebody help me with the code, where i go wrong, and what i need to add?? Thanks on yours fast answers, i hope soon with yours help i will do better, txanks
_________________
 If you like my work, and want to keep me going to upload new releases, download this small file: High Speed Connection: http://rapidshare.com/files/352701103/ThankYou Low Speed Connection: http://rapidshare.com/files/340569064/ThankYou.txt


|