<?php
class test_a
{
static public function run()
{
$test = new test_a();
include("test2.php");
$test->test_b = new test_b();
$test->test_b->testfunction();
}
public function abc()
{
return 'Testing 123';
}
}
test_a::run();
?>
test2.php
<?php
class test_b
{
public function testfunction()
{
return $this->abc();
}
}
?>
How can I execute the abc() function in test2.php when the abc() function is in the test_a class in test.php?
Question
Swift-R
test.php
<?php class test_a { static public function run() { $test = new test_a(); include("test2.php"); $test->test_b = new test_b(); $test->test_b->testfunction(); } public function abc() { return 'Testing 123'; } } test_a::run(); ?>test2.php
<?php class test_b { public function testfunction() { return $this->abc(); } } ?>How can I execute the abc() function in test2.php when the abc() function is in the test_a class in test.php?
Edited by MNunes2Link to comment
Share on other sites
14 answers to this question
Recommended Posts