1

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

Array
(
     [id] => 14
     [name] => My Name
     [*createdAt] => Carbon\Carbon Object
         (
             [date] => 2020-03-18 10:00:26.000000
             [timezone_type] => 3
             [timezone] => UTC
         )

     [*updatedAt] => Carbon\Carbon Object
         (
             [date] => 2020-08-26 10:10:10.000000
             [timezone_type] => 3
             [timezone] => UTC
         )
)

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

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

Stefanos Kargas
  • 10,547
  • 22
  • 76
  • 101

1 Answers1

3

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

Dieter Kräutl
  • 657
  • 4
  • 8