Difference between #35 and #36 of
Yii3 - How to start

Revision #36 has been created by rackycz rackycz on Oct 14, 2025, 8:50:24 AM with the memo:

edit
« previous (#35) next (#37) »

Changes

Title unchanged

Yii3 - How to start

Category unchanged

Tutorials

Yii version unchanged

3.0

Tags unchanged

Content changed

[...]
## Construct vs Invoke
It may be confusing that some classes contain both methods. Note that "property promotion" should be only used in `__construct()`.
Magic method `__invoke()` is only used if you create an instance and then use it as a function. Example:

```php
$obj = new MyObj();
 // Now the __construct() is executed
$obj(); // Now the __invoke() is executed
```

To be honest, I still do not fully understand the real purpose of this situation.
[...]
2 0
5 followers
Viewed: 42 299 times
Version: 3.0
Category: Tutorials
Tags:
Written by: rackycz rackycz
Last updated by: rackycz rackycz
Created on: Oct 8, 2025
Last updated: 2 months ago
Update Article

Revisions

View all history