How to print all properties of an object

To print all properties of an object in PHP, you can use the get_object_vars function, which returns an associative array of an object's properties. You can then iterate over the array and print each property.

Here is an example:

<?php

$object = new stdClass();
$object->name = 'John';
$object->age = 30;
$object->city = 'New York';

$properties = get_object_vars($object);
foreach ($properties as $property => $value) {
  echo $property . ': ' . $value . PHP_EOL;
}

This will output the following:

name: John
age: 30
city: New York