Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-06-2008, 08:20 AM
Junior Member
 
Join Date: Oct 2008
Posts: 13
Default Lazy initialization

I have this class:

PHP Code:
class App
{
    
    static public 
$obj;
    
    public function 
obj()
    {
        if (!isset(
self::$obj))
            
self::$obj = new Obj();
        
        return 
self::$obj;
    }
    

Is this kind of lazy initialization more resourse/memory demanding because of returning the object with every request?

In other words, does the App:bj() takes more memory than direct approach with App::$obj

Thanks for any advice!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:51 AM.