Help!! trying to create a 10 by 10 print


I’ve trying to learn php on my own for workplace. I found a little puzzle I wanted to try but no one at work will help me. The ans to the puzzle looks like this. I have figured out how to get this but not in even rows or columns. I’m coming from the mainframe side to PC and I did this using an array. One co-worker said I was making it too hard and I could do this with if stmts, a loop and a function. I can find basics for these but not anything a little more advanced. Could some one point me in the right direction? I really want to learn this language.



Not sure what you are asking? You want to know how to print 10x10 single characters? Simple…
You don’t mean you want to duplicate that display exactly?

Well, here is one way…
for ($i = 1; $i <= 10; $i++) {
for ($j = 1; $j <= 10; $j++) {
echo “z”;
echo “
”; // End of line…
Hope that is what you are looking for…

But, here is an interesting little code thingy to look at and puzzle over… (Two lines! Success!)

<?PHP $tmp="^OMM$^^OM^^^$^OO$^$"."M^^$"."$"."O^$"."OMMO$^$"."MO$"."OM^M$"."$"."OOM$"."OMMOOOO^O$^^M$^O$"."OM^M^^OOO^MMOOOOOOO$"."MM^$"."OMMOMOM$"."M^$^"; for ($i = 0; $i <= 9; $i++) echo substr($tmp, $i * 10, 10)."
"; ?>