Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Help with an array

Posted on 2009-05-20
2
Medium Priority
?
192 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

885 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