how to call one class method from another in php
<?php
class a{
public function f1(){
echo 'this is a:f1 function';
}
}
class b{
function f2(){
a::f1(); // claa here method of another class in php
echo '<br> This is b:f2 function';
}
}
$ob= new b();
$ob->f2();
?>
OutPut:
this is a:f1 function
This is b:f2 function
Comments
Post a Comment
If you Satisfied , Please Leave a comment