class Car { public $brand; public $model; function __construct($brand, $model) { $this->brand = $brand; $this->model = $model; } function drive() { echo "I am driving a " . $this->brand . " " . $this->model; } } $car = new Car("Toyota", "Camry"); $car->drive();
use Carbon\Carbon; $date = new Carbon(); echo $date->format('Y-m-d H:i:s');In this example, we used the Carbon package library to create a new date object (`$date`) and format it to display the current date and time in `Y-m-d H:i:s` format. The Carbon package library is a popular package for working with dates and times in PHP.