- array_shift: documentation ( source)
<?php
class Foo {
function fun($bar) {
echo "fooo" . $bar;
}
}
$parts = ['Foo', 'fun'];
$controller = array_shift($parts);
$method = array_shift($parts);
call_user_func_array([new $controller, $method], $parts);