php call function from another file class code example
Example 1: php import function from another file
File1.php :
<?php
function first($int, $string){ //function parameters, two variables.
return $string; //returns the second argument passed into the function
}
?>
File2.php :
<?php
include 'File1.php';
echo first(1,"omg lol"); //returns omg lol;
?>
Example 2: php call method from another class
$classA = new ClassA();
$name = $classA->getName();
echo $name; //Prints John