Jump to content

Dobby

New Members
  • Posts

    2
  • Joined

  • Last visited

Dobby's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Barand thank you for your help . Your comment really helped me!
  2. Hi, I am new to PHP and I have this homework due Sunday, I got it on Friday btw I have complete the first part of it , but I can not complete the second part of it. This is the exercise: Largest Row and Column Write a 4x4 array and fill it with random 1's or 0's 0 0 1 1 0 1 0 0 1 0 1 1 1 0 0 1 Display which row and which column has the biggest number of 1's this is my code: <?php $num = array("0", "1"); $rows = rand(4, 4); //using rand() function to generate 4 different numbers, min & max=4 $cols = rand(4, 4); echo "<table>"; for($i = 1; $i <= $rows; $i++) { echo "<tr>"; for($j = 1; $j <= $cols; $j++) { $td_text = $num[rand(0,(count($num)-1))]; //number spacing echo '<td>'.$td_text.'</td>'; } echo "</tr>"; } ?> [edit : zane] Don't hesitate to use code tags next time ;), it's the <> button.
×
×
  • 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.