Skip to main content
Welcome, Guest. Please login.

Login with username, password and session length
7 Guests, 0 Users

Recent

Topic: Lazy Load Class (Read 17074 times) previous topic - next topic

Lazy Load Class

Code: [Select]
class MyClass {
    public function __construct() {
        echo 'I am initialized!';
    }
}

$getMyClass = function() {
    $myClass = new MyClass();
    return $myClass;
};


Code: [Select]
$myClass = $getMyClass();