-4

I need to get "bar" from this:

array(1) { [1]=> array(2) { ["id"]=> string(4) "8097" ["content"]=> string(3) "bar" } }

Is there any way to do it? (the code is from var_dump).

Matej Bačo
  • 49
  • 1
  • 4

2 Answers2

1

Since I don't know why you want "bar" specifically (i.e., is it just the 'content' of the element with index [1]?) I'll suggest simply:

echo $your_array[1]['content'];
VoteyDisciple
  • 37,319
  • 5
  • 97
  • 97
  • but.. why it doesnt work with this (i changed content into price)? array(1) { [518]=> array(3) { ["market_hash_name"]=> string(46) "Dual Berettas | Dualing Dragons (Field-Tested)" ["price"]=> string(3) "0.1" ["created_at"]=> int(1470238469) } } – Matej Bačo Aug 04 '16 at 14:38
  • Because there is no `[1]` in that example, and there's no `['content']`. There's a `[518]` and some other array keys. That is fundamentally different data than you gave in your example, and you haven't explained what you actually want to accomplish. My code only answers the literal question you posed. – VoteyDisciple Aug 04 '16 at 14:41
0
try array_search('what you want to search','Where you want to search')
Reuben Gomes
  • 878
  • 9
  • 16