I want to get a variable from a php file. I’ve read, that you can use
include 'mypage.php'; and then use the variable. But if I do that it loads the visual part from the other file too (html and css from
Other methods are also apreciated.
I have the var
$screen_name in file
twitter/index.php and want to have it in
include 'twitter/index.php'; echo $screen_name;
If you include the PHP file, it will also do the output. But you can suppress it with output buffering.
ob_start(); include './mypage.php'; ob_end_clean(); echo $varFromMypage;