<?php class Test { public static function bar(array $ids) { return array_map(function($id) { return static::foo($id); }, $ids); } public static function foo($id) { return "halo {$id}"; } } class Test1 extends Test { public static function foo($id) { return "hi {$id}"; } } $className = Test1::class; //Let's say line above is input from user or some other code. $ids = [1, 2, 3, 4, 5]; print_r(call_user_func([$className, 'bar'], $ids));
You have javascript disabled. You will not be able to edit any code.