php – How can I prevent a loop to create keys without quotes?-ThrowExceptions

Exception or error:

This is my loop:

foreach ($array as $key => $value) {
          $array1[$value->getUuid()][$value->getFields()->getName()] = $value->getContent();
        }

The result is:

array:2 [▼
  "d8ab80f4f6" => array:16 [▶]
  9087785727 => array:16 [▶]
]

I do not understand, why the last key does not have quotes. How can I prevent this?

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *