- array_map: documentation ( source)
- strtoupper: documentation ( source)
<?php
class Foo
{
function bar(string $foo) : string {
return strtoupper($foo);
}
protected $foosdone = [];
function __construct(array $foos) {
$this->foosdone = array_map(function (string $foo) : string { return $this->bar($foo); }, $foos);
}
}
new Foo(['a', 'b', 'c']);