Difference between #37 and #38 of
Yii3 - How to start

Revision #38 has been created by rackycz rackycz on Oct 14, 2025, 12:29:13 PM with the memo:

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

Changes

Title unchanged

Yii3 - How to start

Category unchanged

Tutorials

Yii version unchanged

3.0

Tags unchanged

Content changed

[...]
public function go($a) { return strtoupper($a); }
}
$instance = new MyUpper();
$array = ['a', 'B', 1, '1'];

// __invoke is used:
 
var_dump($instance($array[0]));  var_dump(array_map($instance, $array)); // __invoke is used // These do the same without invoking:
var_dump(array_map('strtoupper', $array));
var_dump(array_map([$instance, 'go'], $array));
var_dump(array_map(function($a) use ($instance) { return $instance->go($a); }, ['a','B',1,'1']));
```
[...]
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