Solved

Help with an array

Posted on 2009-05-20
2
182 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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 i…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

624 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