Search found 45 matches

by gammaman
Thu Mar 06, 2008 3:42 pm
Forum: PHP - Code
Topic: comparing values in two arrays please help
Replies: 9
Views: 655

Re: comparing values in two arrays please help

Never Mind I got it   <?php               function arrays($array1,$array2)   {      if ( count ($array1) != count ($array2) ){     echo ' Arrays are not the same size ';     }     else {          $array3=array();         $countb = 0;         $array2_reverse = array_reverse($array2);                 ...
by gammaman
Thu Mar 06, 2008 3:34 pm
Forum: PHP - Code
Topic: comparing values in two arrays please help
Replies: 9
Views: 655

Re: comparing values in two arrays please help

It still did not work so I tried another way, still won't print anything   <?php               function arrays($array1,$array2)   {      if ( count ($array1) != count ($array2) ){     echo ' Arrays are not the same size ';     }     else {          $array3=array();         $countb = 0;         $arra...
by gammaman
Thu Mar 06, 2008 12:14 pm
Forum: PHP - Code
Topic: comparing values in two arrays please help
Replies: 9
Views: 655

Re: comparing values in two arrays please help

when I use your code it does not work. All that prints is "Array"?   <?php     function arrays($array1,$array2)   {     if(count ($array1) != count ($array2))     {       echo "Number of item are not equal";     }          $reverse = array_reverse($array2);      $array3= array();...
by gammaman
Thu Mar 06, 2008 10:11 am
Forum: PHP - Code
Topic: comparing values in two arrays please help
Replies: 9
Views: 655

Re: comparing values in two arrays please help

Yes you understand perfectly, have not tested your code yet, but will asap, thank you very much.
by gammaman
Thu Mar 06, 2008 8:43 am
Forum: PHP - Code
Topic: comparing values in two arrays please help
Replies: 9
Views: 655

Re: comparing values in two arrays please help

Here is my updated code, still need help please!!!   <?php     function arrays($array1,$array2)   {     if(count ($array1) != count ($array2))     {       echo "Number of item are not equal";     }     else     {        $array3= array();        $countb=count($array2);        foreach($array...
by gammaman
Thu Mar 06, 2008 7:16 am
Forum: PHP - Code
Topic: comparing values in two arrays please help
Replies: 9
Views: 655

comparing values in two arrays please help

I am working on the following question and do not really know where to start Here is the question: Compare the first element of array1 to the last element of array2 and so on, each time storing the larger when compared in a thrid array so for example in array1 the first element is 12 and in array2 t...
by gammaman
Tue Mar 04, 2008 6:22 pm
Forum: PHP - Code
Topic: printing a 2D array in a multi column table
Replies: 1
Views: 365

printing a 2D array in a multi column table

How can I change the following code   <?php function print_array ($array_name) {     echo ("<table border =\"1\">");   foreach ($array_name as $itm=>$var)   {       foreach ($var as $new){       echo "<tr><td>$new</td></tr>";   }       }     echo "</table>"; }...
by gammaman
Tue Feb 26, 2008 9:09 am
Forum: PHP - Code
Topic: help with for loops
Replies: 1
Views: 332

help with for loops

How can I change this code   <html> <table border="1">  <tr>     <th></th> <?php     for($i=1; $i<=9;$i++){         echo "<th>", $i, "</th>";  //print the column header     } ?> </tr> <?php     for ($i=1; $i<=9; $i++){         echo "<tr>";         echo "<...
by gammaman
Mon Feb 25, 2008 3:20 pm
Forum: PHP - Code
Topic: help with forms
Replies: 1
Views: 307

help with forms

I need help with a form that allows the user to enter and submit the information, and then that information that they enter is automatically dislplayed below on the same page, after they hit the submit button. Here is the code I have. Here is the html code (comment.html) ***** PLEASE USE THE CODE TA...
by gammaman
Fri Feb 22, 2008 6:58 pm
Forum: PHP - Code
Topic: Arrays and dividing
Replies: 3
Views: 73

Re: Arrays and dividing

Yes but I cannot divide by 3, I need to divide no matter how many students are in the array. There are three now including student zero, but there might not be three later
by gammaman
Fri Feb 22, 2008 6:20 pm
Forum: PHP - Code
Topic: Arrays and dividing
Replies: 3
Views: 73

Arrays and dividing

Mod | Please use , [code] and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: <!-- s:arrow: --><img src=\"{SMILIES_PATH}/icon_arrow.gif\" alt=\":arrow:\" title=\"Arrow\" /><!-...
by gammaman
Thu Feb 21, 2008 5:49 am
Forum: PHP - Code
Topic: help with two dimensional array
Replies: 1
Views: 75

help with two dimensional array

How would I take the following array and add up and average each student, then print them out after using asort(). (This is NOT a HW assignment, I am just having a lot of trouble understanding 2d arrays and how they work so I thought I would set up an example. $Student = array ( array (92,100,91), a...
by gammaman
Mon Feb 18, 2008 7:51 am
Forum: PHP - Code
Topic: two dimensional arrays
Replies: 2
Views: 97

Re: two dimensional arrays

Thank you, that helps a lot :D
by gammaman
Sun Feb 17, 2008 5:06 pm
Forum: PHP - Code
Topic: two dimensional arrays
Replies: 2
Views: 97

two dimensional arrays

I am new to programming and was need help. Can someone please give me an example
of how to use a foreach loop to go through the indexes of a two dimensional array.
by gammaman
Tue Feb 12, 2008 9:25 am
Forum: PHP - Code
Topic: help with a program
Replies: 2
Views: 116

help with a program

I wrote the following code to display the multiplication tables. Instead of having one large table like it is now, I want to create 10 seperate tables with spaces between them. Anyone have any suggestions? <html> <!-- Matthew Fierro Tables --> <table border = "1">; <?php for ($a=1; $a<=10;...