Skip to content
Advertisement

What is the meaning of the asterisk before an array key name in print_r

When using print_r($myArray, true) for one of my arrays I get:

JavaScript

What is the meaning of the asterisk in [*createdAt] and [*updatedAt]?

Also, I cannot access these fields. How can I access them?

Advertisement

Answer

The asterisk indicates an Object. And it is protected. This is the reason why you can’t access them.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement