I have two files like below
SomeClass.php
class SomeClass {
public function display() {
$content = file_get_contents("helloworld.php");
eval($content);
}
public function helloWorld() {
echo "hello World!";
}
}
helloworld.php
<?php
$this->helloWorld() ;
?>
<p>It's html expression</p>
As you can see, I tried to execute helloworld.php in the display function. Of course, It occur an error because the html tag is placed in the display function.
Is there any good way to execute helloworld.php text in the display function preserving helloworld.php code?
requirehelloworld.php?