Source Code:
(back to article)
<?php class User { public static $count = 0; public function __construct() { self::$count++; } } $user1 = new User(); $user2 = new User(); echo User::$count; // Outputs: 2 ?>
Result:
Report an issue