5

While using dd() function in Laravel, if my output looks like this,

Collection {#194 ▼
  #items: array:3 [▼
    0 => Post {#195 ▶}
    1 => Post {#196 ▶}
    2 => Post {#197 ▶}
  ]
}

what are the meanings of the codes, such as #194, #195, etc? Are they helpful in any way?

code_locked
  • 95
  • 4
  • 12

1 Answers1

7

According to VarDumper documentation - that's what dd() uses behind the hood:

#14 is the internal object handle. It allows comparing two consecutive dumps of the same object. 

Depending on whether the item being dumped is an object or PHP resource, you'll see # for objects and @ for resources in there. The number you're seeing after # is the ID assigned by the VarDumper to that object. It's displayed so that you can easily identify dumps for the same object, if you dump it multiple times.

jedrzej.kurylo
  • 39,591
  • 9
  • 98
  • 107