Skip to main content
Welcome, Guest. Please login.

Login with username, password and session length
1 Guest, 0 Users

Recent

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