I was reading the source code of index.php in Basic Template when I suddenly noticed the last line “(new yii\web\Application($config))->run();”, It occurs to me if Yii 2 will create a new yii\web\Application instance for each request.
I used to be a Java coder, but now I’m a PHP newbie. So I’m wondering if Yii 2 or PHP will cache such a heavy object for reusing, and if at some moment it will be auto-released, just like a Java object stay in Java Virtual Machine.
I know that an application instance is attached to \Yii class. So a related question is: how long will the \Yii class stay in the PHP environment(or we can call it “PHP Virtual machine”)? So we can get it for next requests?