Question: I have a string ($source) which is containing the following data:

```
{"Title":"War Horse","Year":"2011","Rated":"PG-13","Released":"25 Dec 2011","Runtime":"2 h 26 min","Genre":"Drama, War","Director":"Steven Spielberg","Writer":"Lee Hall, Richard Curtis","Actors":"Jeremy Irvine, Emily Watson, David Thewlis, Benedict Cumberbatch","Plot":"Young Albert enlists to serve in World War I after his beloved horse is sold to the cavalry. Albert's hopeful journey takes him out of England and across Europe as the war rages on.","Poster":"http://ia.media-imdb.com/images/M/MV5BMTU5MjgyNDY2NV5BMl5BanBnXkFtZTcwNjExNDc1Nw@@._V1_SX640.jpg","imdbRating":"7.2","imdbVotes":"39,540","imdbID":"tt1568911","Response":"True"}

```

I'm extracting the title, the genre, the plot and so on by using this:

```
foreach(str_getcsv($source) as $item) {
    list($k, $v) = explode(':', $item);
    $$k = str_replace('"', '', $v);
    }

```

So far, this works very well, I'm able to use $Title, $Genre and so on. The only thing that doesn't work is the URL to the poster since I'm exploding the ':' and the URL - of course - contains ':' (after the 'http').

How can I put the poster URL into a variable?

Answer: 
That looks like JSON data, why not simply:

```
$txt = '{"Title etc.....}';
$data = json_decode($txt);

$title = $data['Title'];
$genre = $data['Genre'];
etc...

```

variable variables are highly ugly, and you risk compromising your code by overwriting some other variable with the contents of the JSON data.

if you REALLY insist on poluting your namespace with auto-vivified variables, you can always use [`extract()`](http://ca.php.net/extract) to pull apart the array
Use **json\_decode**

```
$str = '{"Title":"War Horse","Year":"2011","Rated":"PG-13","Released":"25 Dec 2011","Runtime":"2 h 26 min","Genre":"Drama, War","Director":"Steven Spielberg","Writer":"Lee Hall, Richard Curtis","Actors":"Jeremy Irvine, Emily Watson, David Thewlis, Benedict Cumberbatch","Plot":"Young Albert enlists to serve in World War I after his beloved horse is sold to the cavalry. Albert\'s hopeful journey takes him out of England and across Europe as the war rages on.","Poster":"http://ia.media-imdb.com/images/M/MV5BMTU5MjgyNDY2NV5BMl5BanBnXkFtZTcwNjExNDc1Nw@@._V1_SX640.jpg","imdbRating":"7.2","imdbVotes":"39,540","imdbID":"tt1568911","Response":"True"}';

$decode_string = json_decode($str);

print_r($decode_string);
echo $decode_string->Title;

```

Here is the running code [Click Here](http://codepad.org/pvMYirMO)