Jump to content

JoshDiaw01

New Members
  • Posts

    3
  • Joined

  • Last visited

JoshDiaw01's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you for taking the time to go into detail. I've mostly been learning from the tutorial at Code Academy. The insight that you guys have provided me has been very helpful.
  2. Thank you. It all makes sense now since I was confused as to what the single characters meant. Does that mean that "T"data is for the table? And in the for loop we have temporary variables that could be named anything, right?
  3. Hello, I am new to PHP programming and recently I've been looking over random generated programs. I ran across this code and I would like to understand it better because the person that wrote it did not write comments or use descriptive names for the variables. Thank you <?php function randColor() { $r = rand(0,255); $g = rand(0,255); $b = rand(0,255); return sprintf('%02X%02X%02X', $r, $g, $b); } $tdata=''; for ($i=0; $i<10; $i++) { $tdata .= "<tr>"; for ($j=0; $j<20; $j++) { $colors = randColor(); $tdata .= "<td style='background-color:#$colors'>$colors<br><span class='wtext'>$colors</span></td>"; } $tdata .= '</tr>'; } ?> <html> <head> <style type='text/css'> table { border-collapse: collapse; } td { width: 60px; height: 60px; font-family: sans-serif; font-size: 8pt; text-align: center; } .wtext { color: white; } </style> </head> <body> <table border='1'> <?=$tdata?> </table> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.