Is it possible to pass the result of an include to a variable?
Let's consider this simple file 'example.html':
<p>some HTML</p>
In a PHP file, how can we pass the content of this file to a variable? I tried:
$my_variable = include('example.html');
It includes the file, but the value of $my_variable
is 1
.
use
If you just want to get the content of file you can use this :
or this :