0

I have an array, parsed from a yaml string, which behaves weird. This code produces the following output:

var_dump($params['layout']);

var_dump($params);

foreach($params as $key => $value) {
    echo $key . ': ' . $value . '<br>';
}

Output:

NULL

array(4) {
  ["layout"]=>
  string(4) "home"
  ["title"]=>
  string(4) "home"
  ["date"]=>
  string(10) "2017-03-21"
  ["description"]=>
  string(55) "Everything is alive and other tales from the thresholds"
}

layout: home
title: home
date: 2017-03-21
description: Everything is alive and other tales from the thresholds

Why does accessing the first item by key return null?

thgie
  • 2,367
  • 1
  • 18
  • 28

0 Answers0