- class_parents: documentation ( source)
- implode: documentation ( source)
<?php
try {
$reflection = new ReflectionClass(DateTimeImmutable::class);
$date = $reflection->newInstanceWithoutConstructor();
$date->format('Y-m-d H:i:s');
} catch (Throwable $exception) {
echo $exception->getMessage(), "\n",
$exception::class, "\n",
implode("\n", class_parents($exception));
}