I am beginning to see, I think, what you are dealing with, the pos() function (and others) are used to step thru arrays moving a cursor pointer as you go, and logically would be connected with next() and prev() to step forward and backward. This is more logical to use when the keys assigned are not consecutive (0, 1, 2, 3, etc). Also sounds like you want to insert occurrences between occurrences already in the array. I think you used the term store. This can be done with php arrays (as in perl) when the associated key is actually a data item. There may be other ways, but I always test for the presence of an occurrence by; if(isset($datatable[$key])) update occurance... else $datatable[$key] = insert new occurance... PHP arrays can also be multi-dimensional; $datatable[$key] = array($column1, $column2); and, if it make sense all new entries can be added to the end of an array $datatable[] = array($column1, $column2); and resorted to place the entire array into order. sort($datatable); php multi-dimensional arrays can also be referrenced a multitude of ways. I frequently resort to references like $datatable[$rowno][$colno] = insert value; $recallvalue = $datatable[$rowno][$colno]; This may not answer your questions, but perhaps give you a few more ideas. Just try a few to learn more. good luck, Warren Vail warren@vailtech.net -----Original Message----- From: Disko_kex [mailto:disko_kex@swedish-mushroom.com] Sent: Monday, August 25, 2003 1:55 AM To: 'Warren Vail'; php-windows@lists.php.net Subject: RE: [PHP-WIN] Array question Well its not exactly what I was looking for but you gave me some ideas, but still got this small problem: If I know the value in the array, say for example 49. Then I want to store the previous and next value in the array? I know the other way when I have the position, just use pos($dataarray) then like you sad $dataarray($key+1), that's easy. But the other way???? -----Original Message----- From: Warren Vail [mailto:warren@vailtech.net] Sent: den 25 augusti 2003 09:33 To: Disko_kex; php-windows@lists.php.net Subject: RE: [PHP-WIN] Array question in my experience, using numeric indices to your array, you can deposit and reference occurances as follows; however your reference is not a valid array definition; [0] => 1 [1] => 2 [2] => 3 ... [99] => 100 (I don't believe these are valid as a definition) numeric indices would be defined as follows; array(0 => 1, 1 => 2, 2 => 3 .... 99 => 100); $x = $dataarray[50]; $dataarray[50 - 2] = $x; $dataarray[50 + 1] = $x; if($dataarray[71] == 74) do this.... On the other hand, if the indices is alpha-numeric string representations of numbers, array("0" => 1, "1" => 2, "2" => 3 ... "99" => 100) you will need to use some other tricks to access them. hope this is what you are looking for, you used several terms like "select" and "know the value" of that are somewhat ambiguous ;-) Warren Vail warren@vailtech.net -----Original Message----- From: Disko_kex [mailto:disko_kex@swedish-mushroom.com] Sent: Sunday, August 24, 2003 11:59 PM To: php-windows@lists.php.net Subject: [PHP-WIN] Array question If I have an array like this > [0] => 1 [1] => 2 [2] => 3 ... [99] => 100 If I want to select [50] => 51 and store the value that's 2 positions before and 1 position after, how can I do? If I want to know what position value 71 have? I have search the PHP-manual and found some functions as prev, next, pos etc. But with these commands I have to loop thru the array every time to reach the the values and positions. It has to be an easier way to do it. // jocke -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php