SetToLoki Posted October 21, 2007 Share Posted October 21, 2007 I have an array that when displayed t screen with print_r gives this result (data changed for protection) Array ( [0] => 8533724 [1] => 2525862 [2] => 1MMO [3] => WRD [4] => 234 [5] => 0 [6] => 234 [7] => 21-Nov-00 [8] => 20-Nov-07 [9] => C [10] => 1D [11] => 21D29 [12] => 15-Mar-07 [13] => 31-Aug-07 [14] => 234 [15] => 19.5 [16] => 0 [17] => 136.5 [18] => Mrs [19] => M [20] => Jackson [21] => 44 [22] => Openshaw Drive [23] => [24] => Blackburn [25] => BB1 [26] => 8RH [27] => MAS (2004) LTD [28] => Monitored [29] => permanent [30] => ) Array ( [0] => 10255808 [1] => 9504304 [2] => 1PAO [3] => WLS [4] => 174 [5] => 0 [6] => 174 [7] => 20-Jan-04 [8] => 19-Jan-08 [9] => C [10] => 1D [11] => 21D29 [12] => 22-Jan-07 [13] => 19-Jan-08 [14] => 174 [15] => 14.5 [16] => 0 [17] => 130.5 [18] => Miss [19] => [20] => Maqsood [21] => 1 [22] => Aberdeen Dr [23] => [24] => Blackburn [25] => BB1 [26] => 1LS [27] => MAS (2004) LTD [28] => #N/A [29] => permanent [30] => ) Array ( [0] => 8516656 [1] => 2523886 [2] => 1MMO [3] => WRD [4] => 234 [5] => 0 [6] => 234 [7] => 16-Sep-99 [8] => 15-Sep-07 [9] => C [10] => 1D [11] => 21D29 [12] => 03-Jul-06 [13] => 11-Jun-07 [14] => 234 [15] => 19.5 [16] => 0 [17] => 97.5 [18] => Mrs [19] => [20] => Musgrave [21] => 118 [22] => Pleckgate Road [23] => [24] => Blackburn [25] => BB1 [26] => 8PN [27] => MAS (2004) LTD [28] => Monitored [29] => permanent [30] => ) As you can see it contains several Array () all with [30] entries I would like to know how to manipulate this array so I could get the info from each array ie if I wanted to get [20] form the 2nd array returned in my print_r would expect to type something like $array_data[2][20] so my question summed up how can I alter my array that I have now to return the seperate results as I need. if I am not clear on my question and to be honest I confused myself let me know. Quote Link to comment https://forums.phpfreaks.com/topic/74184-solved-help-with-array/ Share on other sites More sharing options...
papaface Posted October 21, 2007 Share Posted October 21, 2007 I dont see a multidimensional array, I just see two arrays ??? Either way, you'd access its by doing $array[30][2] that would look for the element 30's array, and fetch element 2 from it. You should do: foreach ($array as $k => $v) { echo $k . " => " . $v . "<br />"; } Quote Link to comment https://forums.phpfreaks.com/topic/74184-solved-help-with-array/#findComment-374702 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.