Skip to main content
Welcome, Guest. Please login.

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

Recent

Topic: Lazy Load Class (Read 17325 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();