Solved

Help with an array

Posted on 2009-05-20
2
179 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 is …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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.

756 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