<?php

class Someclass
{
    function  methodPrint($x, $y)
    {
        return $x + $y;
    }
}

function functionPrint($x, $y)
{
    return $x + $y;
}

function myFunction(callable $f)
{
    $args = func_get_args();
    array_shift($args);
    return call_user_func_array($f, $args);
}

$object = new Someclass();
$x = 1;
$y = 2;

echo myFunction([$object, 'methodPrint'], 1, 2);