Forum Moderators: coopster

Message Too Old, No Replies

Help need for array_slice

         

akogo

10:34 pm on May 9, 2003 (gmt 0)

10+ Year Member



Is there such a thing like array_slice that works for multi- dimensional arrays?

SinclairUser

10:56 pm on May 9, 2003 (gmt 0)

10+ Year Member



In perl you can use this:

@{$aref}[1,4,7]; # array slice

SinclairUser

11:14 pm on May 9, 2003 (gmt 0)

10+ Year Member



Dont think PHP has a function to return multidimensional array_slice.

ShawnR

11:15 pm on May 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



But the 'multi-dimentional' part of the question is a bit more tricky. Perl does not directly support multi-dimentional arrays. You have to define an array of references to arrays.

Shawn

jatar_k

2:02 am on May 10, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



What exactly are you trying to do akogo?

akogo

5:48 am on May 10, 2003 (gmt 0)

10+ Year Member



jatar_k,

I'm trying to extract and display data from a multi dimensional array only the values or key/value pairs that match a given value.

For example, I want to look up and display only items that are priced $12.95 or less and display every piece of information related to these items (name of item, description etc). Don't want to use mysql if at all possible. I want to get it all done only with PHP.

akogo

10:15 pm on May 10, 2003 (gmt 0)

10+ Year Member



Thanks for your insights all. I figured out my problem through other means.