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
  • 85
  • 2
  • 11

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
  • 36,939
  • 9
  • 88
  • 100