I am trying to decode JSON data to PHP then output it to the site. If I have the following:

```
{
  "name": "josh",
  "type": "human"
{

```

I can do this (within PHP), to display or output my `type`:

```
$file = "path";
$json = json_decode($file);

echo $json["type"]; //human

```

So, if I have the following:

```
{
  "name": "josh",
  "type": "human",
  "friends": [
    {
      "name": "ben",
      "type": "robot"
    },
    {
      "name": "tom",
      "type": "alien"
    }
  ],
  "img": "img/path"
}

```

How can I output what `type` my friend `ben` is?