- array_map: documentation ( source)
- phpversion: documentation ( source)
- print_r: documentation ( source)
<?php
abstract class Super {
public function __construct($something)
{
$this->something = $something;
}
public static function make($array)
{
return array_map(function ($el) {
return new static($el);
}, $array);
}
}
class Child extends Super {
}
echo phpversion(), "\n";
print_r(Child::make([1,2,3]));