EXCELLENT WORK ROB. THANK YOU VERY MUCH. Everything works swell. The following is the breakdown Starting at [0] with the numers to compare the rest with as (0,2,55, 26,41,36, 67,35,36, 69) Row 1 = 26 36 35 36 Row 2 = 0 55 35 Row 3 = 55 36 35 36 etc. I am really grateful Rob. One more more favor if you don't mind. Can you help me understand what you did? This whole exercise is to help me master ARRAYS in php. I must confess I do not completely understand the script. Below is the formula again but this time numbered. I would try and go through it myself and please help me out where I do not understand. <php 1. $max_rows = count($rows) ;

 2. foreach ($rows as $array_key => $array_value) {
 3. echo "<br>Curr row = " . $array_key . " - <br>\n";

 4. for ($i = 0; $i < $max_rows; $i++) {

 5. if ($array_key <> $i) {
 6. $common = array_intersect( $array_value, $rows[$i]); 

7. foreach ($common as $key => $value) { 
8. echo "Key: $key; Value: $value\n"; 
9. }
 10. echo "<BR>";
 11. } 
 12. }
 13. } ?> The following is my attempt at reading the script 1. You created a function called $max_rows? 2. Used a foreach function to set the function in the first function to key and value? 3. Carriage return 4. Loop set to increment? 5. I have no idea what is happening at 5 6. Array-intersect but I am not too sure about $array_value. I don't really understand $array_value 7. Set the foreach function here to give the final output. As you can see I am new to this and I am struggling. Can you break it it down more simply for me please. Finally in the script output, starting [Curr row = 1 -] and so on, the script goes back to compare or intercept with row [0]. How do I get the script to only move forward and not go back to what is left behind in this case [Curr row = 1 -]? Again let me take the opportunity to say; "THANK YOU VERY MUCH" for your help. Very much appreciated. Thank you. Robert --- "Atkinson, Robert" <ratkinson@xxxxxxxxxxxxx> wrote: > What error did you get? > > Did you use the 2nd 'tested' script I posted? > > My output looks something like this .... > > Curr row = 0 - > Key: 3; Value: 26 Key: 5; Value: 36 Key: 7; Value: > 35 Key: 8; Value: 36 > Key: 0; Value: 0 Key: 2; Value: 55 Key: 7; Value: 35 > > Key: 2; Value: 55 Key: 5; Value: 36 Key: 7; Value: > 35 Key: 8; Value: 36 > Key: 0; Value: 0 Key: 1; Value: 2 Key: 2; Value: 55 > Key: 3; Value: 26 Key: 4; > Value: 41 Key: 5; Value: 36 Key: 6; Value: 67 Key: > 7; Value: 35 Key: 8; > Value: 36 Key: 9; Value: 69 > Key: 7; Value: 35 > Key: 1; Value: 2 Key: 5; Value: 36 Key: 7; Value: 35 > Key: 8; Value: 36 > Key: 3; Value: 26 Key: 7; Value: 35 > Key: 0; Value: 0 Key: 2; Value: 55 Key: 7; Value: 35 > > Key: 2; Value: 55 Key: 5; Value: 36 Key: 7; Value: > 35 Key: 8; Value: 36 > Key: 0; Value: 0 Key: 2; Value: 55 Key: 3; Value: 26 > Key: 5; Value: 36 Key: > 6; Value: 67 Key: 7; Value: 35 Key: 8; Value: 36 > Key: 9; Value: 69 > > > -----Original Message----- > From: php-objects@xxxxxxxxxxxxxxx > [mailto:php-objects@xxxxxxxxxxxxxxx] On > Behalf Of Robert Barker > Sent: 17 January 2008 16:32 > To: php-objects@xxxxxxxxxxxxxxx > Subject: RE: HOW DO I CREATE A LOOP > CRAWLER? > > Hi Rob, > > I used your formula and got nothing. Below is what I > did. Can you please tell me where I am going wrong? > > <?php > > $rows = array(); > $rows[0] = array(4,11,24, 26,36,38, 45,35,44, 48); > $rows[1] = array(1,0,13, 9,35,33,47, 25,39,55) ; > $row3[2] = array(4,11,24,26,36,38,45,35,44,48); > $row3[3] = array(1,0,13,9,35,33,47,25,39,55); > $row3[4] = array(5,12,14,54,35,36,48,65,55,87); > $row3[5] = array(0,2,55,26,41,36,67,35,36,69); > $row3[6] = array(1,3,13,24,35,42,42,45,39,70); > $row3[7] = array(1,2,3,64,8,37,6,49,35,36,48); > $row3[8] = array(9,11,24,26,16,38,45,35,44,48); > $row3[9] = array(3,0,13,9,35,23,47,25,39,55); > > > $max_rows = count($rows) ; > > foreach ($rows as $curr_row) { > for ($i = 0; $i <= $max_rows; $i++) { > $common = array_intersect( $curr_row, $rows[$i]); > > foreach ($common as $key => $value) { > echo "Key: $key; Value: $value\n"; > } > > echo "<BR>" > } > } > > ?> > > > Robert barker > > > --- "Atkinson, Robert" <ratkinson@xxxxxxxxxxxxx> > wrote: > > > Very roughly..... > > > > > > $rows = array(); > > $rows[0] = array(4,11,24,26,36,38,45,35,44,48); > > $rows[1] = array(1,0,13,9,35,33,47,25,39,55); > > ...etc,etc > > > > This gives you a known list to work with. Now you > > can loop through the rows. > > > > $max_rows = count($rows); > > > > foreach ($rows as $curr_row) { > > for ($i = 0; $i <= $max_rows; $i++) { > > $common = array_intersect($curr_row, $rows[$i]); > > > > foreach ($common as $key => $value) { > > echo "Key: $key; Value: $value\n"; > > } > > > > echo "<BR>" > > } > > } > > > > You will need to check and make sure $curr_row is > > not the same row as > > '$rows[$i]', otherwise you will always get a match > > (unless you want this of > > course). > > > > Rob. > > > > -----Original Message----- > > From: php-objects@xxxxxxxxxxxxxxx > > [mailto:php-objects@xxxxxxxxxxxxxxx] On > > Behalf Of Robert Barker > > Sent: 17 January 2008 14:57 > > To: php-objects@xxxxxxxxxxxxxxx > > Subject: HOW DO I CREATE A LOOP > > CRAWLER? > > > > > > Hello, I am very new to PHP and I am focusing on > > arrays to speed up my learning curse on the > > programme. > > The following is an array I am working with and I > am > > stuck. Can anyone help please? > > > > > > <?php > > > > // The following is a table > > > > $row_1 = array(4,11,24,26,36,38,45,35,44,48); > > $row_2 = array(1,0,13,9,35,33,47,25,39,55); > > $row_3 = array(5,12,14,54,35,36,48,65,55,87); > > $row_4 = array(0,2,55,26,41,36,67,35,36,69); > > $row_5 = array(1,3,13,24,35,42,42,45,39,70); > > $row_6 = array(1,2,3,64,8,37,6,49,35,36,48); > > $row_7 = array(9,11,24,26,16,38,45,35,44,48); > > $row_8 = array(3,0,13,9,35,23,47,25,39,55); > > $row_9 = array(5,12,15,14,35,36,43,65,55,87); > > $row_10 = array(0,5,55,26,31,36,67,35,36,69); > > $row_11 = array(1,3,17,24,34,42,42,45,33,70); > > $row_12 = array(1,1,3,66,8,37,6,49,35,36,48); > > $row_13 = array(0,2,55,26,41,36,67,35,36,69); > > $row_14 = array(1,3,13,24,35,42,42,45,39,70); > > $row_15 = array(1,2,3,64,8,37,6,49,35,36,48); > > $row_16 = array(9,11,24,26,16,38,45,35,44,48); > > $row_17 = array(3,0,13,9,35,23,47,25,39,55); > > $row_18 = array(5,12,15,14,35,36,43,65,55,87); > > $row_19 = array(0,2,55,26,41,36,67,35,36,69); > > $row_10 = array(1,3,13,24,35,42,42,45,39,70); > > $row_21 = array(1,2,3,64,8,37,6,49,35,36,48); > > $row_22 = array(9,11,24,26,16,38,45,35,44,48); > > $row_23 = array(1,0,13,9,35,33,47,25,39,55); > > $row_24 = array(5,12,14,54,35,36,48,65,55,87); > > $row_25 = array(0,2,55,26,41,36,67,35,36,69); > > $row_26 = array(1,3,13,24,35,42,42,45,39,70); > > $row_27 = array(1,2,3,64,8,37,6,49,35,36,48); > > $row_28 = array(9,11,24,26,16,38,45,35,44,48); > > $row_29 = array(3,0,13,9,35,23,47,25,39,55); > > $row_30 = array(5,12,15,14,35,36,43,65,55,87); > > $row_31 = array(0,2,55,26,41,36,67,35,36,69) > > > > > > // Next is to find the common element(number) in > > each > > row > > > > $common = array_intersect($row_1, $row_2); > > > > foreach ($common as $key => $value) { > > echo "Key: $key; Value: $value\n"; > > } > > echo "<BR>" > > ?> > > > > > > > > My problem is the above works only on $row_1 and > > $row_2, and I am stuck. > > > > My question is two-fold. The first is, how do I > > write > > the LOOP to get $row_1 to go through and intersect > > with the rest of the rows in the table, that is, > to > > intersect with $row_3, $row_4 etc and not just > stop > > at > > $row_2? > > > > The second question is; if the LOOP goes through > to > === message truncated === ___________________________________________________________ Yahoo! Answers - Got a question? Someone out there knows the answer. Try it now. http://uk.answers.yahoo.com/