class Product { private static $count = 0; public function __construct() { self::$count++; } public static function getCount() { return self::$count; } } $product1 = new Product(); $product2 = new Product(); echo "Total number of products: " . Product::getCount(); // Output: Total number of products: 2In this code example, a `Product` class is defined and the `__construct` method is used to increment the static `$count` property each time a new instance of the class is created. The `getCount` method is then used to return the total number of products instantiated. This feature is included in the PHP core library and does not require any additional package libraries.