-2

I cannot figure out getting the string 'foo' printed from an array. How can I just print the value in 'tags'?

print_r(array_values($res));

Array
(
    [0] => Array
        (
            [tags] => foo
        )

)
AbraCadaver
  • 78,200
  • 7
  • 66
  • 87
MikeSkril
  • 77
  • 1
  • 9

1 Answers1

0

Arrays work in depth. You can have array that store arrays and so on. If:

$res = array ( 0 => array ( ['tags'] => 'foo' ) );
echo $res[0]['tags']; // foo

does that make sense?

Also, be careful when using Array and array

Array vs array

Ice76
  • 1,143
  • 8
  • 16