Solved

Help with an array

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article discusses four methods for overlaying images in a container on a web page
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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 look for a specific file type in a local or remote server directory using PHP.

734 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