$str = '$temp["items"][0]["title"][0]'
$temp = json_decode($json, true);
$str = '$temp["items"][0]["title"][0]';
$temp = json_decode($json, true);
$prepared_string = explode('[', $str, 2)[1];
$result = $temp;
foreach (explode('][', $prepared_str) as $part) {
$result = $result[trim($part, '"]');
}
var_dump($result);