how to pass argument from the class b

class B {


}

function check_hint(B $someclass){

}
$a=5;

check_hint($a);

    I feel like we may need more info, but if you are going to specify a class name as the function argument type, then it will only accept an instance of that class (or of a child class).

    $a = new B();
    check_hint($a);
    
    Write a Reply...