Skip to main content
Welcome, Guest. Please login.

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

Recent

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