-3

I would like to get value of "url". How can I do this? Please help! Thanks.

Array(
        [value] => Array
            (
         [url] => http://localhost/azmith/wp-content/uploads/2018/10/hero-img.jpg
               ) )

The complete array is following:

    <?php

       Array(
                ["ID"] => 55,
                ["key"] => "field_5bb500e3e1d6a",
                ["label"] => "Main Banner Image",
                ["type"] => "image",
                ["value"] => Array
(
                        ["ID"] => 63,
                        ["title"] => "hero-img",
                        ["filename"] => "hero-img.jpg",
                        ["url"] => "http://localhost/azmith/wp-content/uploads/2018/10/hero-img.jpg",
                    ),
            );

    ?>
11
  • If it is single dimensional array you can get it like : $arr['value']['url']; Assuming $arr is your array. Commented Oct 4, 2018 at 13:42
  • no its multidimensional array @sehdev Commented Oct 4, 2018 at 13:45
  • @Faa Show us the code and full array. Commented Oct 4, 2018 at 13:46
  • @vicek i was using this $array = array("value" => array("url") ); and output was this: Array ( [value] => Array ( [0] => url ) ) Commented Oct 4, 2018 at 13:49
  • i have already posted the array Commented Oct 4, 2018 at 13:49

1 Answer 1

-1

Try this

$url = $yourArrayName['value']['url'];

Sign up to request clarification or add additional context in comments.

20 Comments

its not working @jitendra
Please never, ever, ever post code only answers.
i was using this $array = array("value" => array("url") ); and output was this: Array ( [value] => Array ( [0] => url ) )
@Faa Maybe your array variable name is $array. So try echo $array['value']['url'];
@vivek_23 This question is a mega duplicate, please support the closure.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.