2

In PHP when I do

var_dump($galleryCategoriesThumb);

Output is

    array(1) {


[0]=>
  array(1) {
    ["Gallery"]=>
    array(3) {
      ["id"]=>
      string(3) "190"
      ["photofile"]=>
      string(6) "50.jpg"
      ["gallery_category_id"]=>
      string(2) "58"
    }
  }
}

When I do

var_dump($galleryCategoriesThumb["photofile"]);

I get NULL output. I tried various other options also. All I want to do is echo ["photofile"]. Please help.

3 Answers 3

3

Try $galleryCategoriesThumb[0]['Gallery']["photofile"]

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

Comments

1

Try var_dump($galleryCategoriesThumb[0]["Gallery"]["photofile"]);.

It's a 3 dimensions array.

Comments

1

It is expected that var_dump($galleryCategoriesThumb["photofile"]) returns NULL because "photofile" key does not exist in $galleryCategoriesThumb.

To access "photofile", you need a 'full path' in the array as posted by others

var_dump($galleryCategoriesThumb[0]["Gallery"]["photofile"]);. 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.