Skip to main content
2 Guests, 0 Users
Welcome, Guest. Please login.

Login with username, password and session length

Recent

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