2 replies
Is there a way to pull only the values out of a multidimensional array?

I have a big mess of an array like this:
Array ( [0] => Array ( [0] => Array ( [0] => VALUE ) [1] => Array ( [0] => VALUE ) ) [1] => Array ( [0] => Array ( ) [1] => Array ( ) ) [2] => Array ( [0] => Array ( ) [1] => Array ( ) ) [3] => Array ( [0] => Array ( ) [1] => Array ( ) ) [4] => Array ( [0] => Array ( ) [1] => Array ( ) ) [5] => Array ( [0] => Array ( ) [1] => Array ( ) ) [6] => Array ( [0] => Array ( [0] => VALUE ) [1] => Array ( [0] => VALUE ) ) )

I just want to rip the values out and place them in a new array, but there doesn't seem to be a function for that. Is there?
#array #flatten #php
  • Profile picture of the author ussher
    it wont be a mess if you look at it in the source code, it will be nicely laid out.

    or you can put <pre></pre> tags around your array printing device to make it look pretty.

    as for bringing it all back down to a single-dimention array your going to need to do some looping with 'foreach' loops to open each array then put them into a new single storage array.

    This _might_ be the answer your looking for:
    How to "flatten" a multi-dimensional array to simple one in php? - Stack Overflow

    otherwise its build a custom loop time.
    Signature

    "Jamroom is a Profile Centric CMS system suitable as a development framework for building entire communities. Highly modular in concept. Suitable for enterprise level development teams or solo freelancers."

    - jamroom.net
    Download Jamroom free: Download
    {{ DiscussionBoard.errors[4532116].message }}
  • Profile picture of the author Big Squid
    Thanks for the help..It was what I was looking for...
    {{ DiscussionBoard.errors[4540479].message }}

Trending Topics