How can a timestamp be generated in PHP?

To generate a timestamp in PHP, you can use the `time()` function which returns the current Unix timestamp. This timestamp represents the number of seconds that have passed since the Unix epoch (January 1, 1970). You can use this timestamp for various purposes such as logging events, creating unique identifiers, or tracking time-sensitive data.

$timestamp = time();
echo $timestamp;