Solved

Help with an array

Posted on 2009-05-20
2
174 Views
Last Modified: 2012-05-07
Hi all,

I have a variable $result that outputs the chunck below.
I need to get all the [theurl] in the array .. how can I do it??

Thanks in advance!!

Array

(

    [myfunction] => Array

        (

            [root] => Array

                (

                    [node] => Array

                        (

                            [0] => Array

                                (

                                    

                                    [theurl] => http://myweb.com/tests/1.html

                                    [theimageurl] => http://myweb.com/tests/images/1.jpg

      

                                )
 

                            [1] => Array

                                (

                                    [theurl] => http://myweb.com/tests/2.html

                                    [theimageurl] => http://myweb.com/tests/images/2.jpg

                                )
 

                            [2] => Array

                                (

                                   [theurl] => http://myweb.com/tests/3.html

                                    [theimageurl] => http://myweb.com/tests/images/3.jpg

                                )
 

                            [3] => Array

                                (

                                     [theurl] => http://myweb.com/tests/4.html

                                    [theimageurl] => http://myweb.com/tests/images/4.jpg

                                )
 

                        )
 

                )
 

        )
 

)

Open in new window

0
Comment
Question by:Dada44
2 Comments
 
LVL 7

Accepted Solution

by:
ycTIN earned 500 total points
ID: 24434194

$source = "your array";
 

foreach ($source['myfunction']['root']['node'] as $node) {

	echo $node['theurl'];

}

Open in new window

0
 

Author Closing Comment

by:Dada44
ID: 31583608
thanks!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now