What are some best practices for handling object IDs and object identification in PHP for debugging purposes?

When debugging in PHP, it can be helpful to have unique identifiers for objects to easily track and identify them. One common practice is to use the spl_object_id() function to generate a unique ID for each object. This ID can then be used for debugging purposes to differentiate between different objects.

// Generate a unique ID for an object
$object = new stdClass();
$objectId = spl_object_id($object);

// Output the object ID for debugging
echo "Object ID: " . $objectId;