<?php
class a
{
public $c= "hello rookienerd";
}
//create function with class name argument
function display(a $a1)
{
//call variable
echo $a1->c;
}
display(new a());
?>Output:
<?php
class Test1
{
public $var= "hello rookienerd and SSSIT";
}
//create function with class name argument
function typehint(Test1 $t1)
{
//call variable
echo $t1->var;
}
//call function with call name as a argument
typehint(new Test1());
?>Output:
