To make things easier to explain/understand I have 2 files similar to this:
PHP file A:
PHP file B:
Hopefully makes sense, but the trouble is $output has the echo of both x and y, not just one (as you might expect from and if statement!) I assume this is something to do with using the file_get_contents
EDIT: I just worked out it's not actually 'executing' PHP fileA! Is there a function that will grab the output of the file, and store it as my $output string?
PHP file A:
Code:
<?
if (...) {
echo x;
} else {
echo y;
}
?>
PHP file B:
Code:
<?
$output = file_get_contents(fileA.php);
.
.
[do some things first !important]
.
.
echo $output;
?>
Hopefully makes sense, but the trouble is $output has the echo of both x and y, not just one (as you might expect from and if statement!) I assume this is something to do with using the file_get_contents

EDIT: I just worked out it's not actually 'executing' PHP fileA! Is there a function that will grab the output of the file, and store it as my $output string?
Last edited: