Shared/Singleton Objects


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. class PromotionManager {
  2. static $sharedInstance;
  3.  
  4. static function sharedManager () {
  5. if(!self::$sharedInstance) {
  6. self::$sharedInstance = new self();
  7. }
  8.  
  9. return self::$sharedInstance;
  10. }
  11.  
  12. function __construct() {
  13.  
  14. }
  15. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.