PHP: file_get_contents() or simlar

Soldato
Joined
18 Oct 2002
Posts
9,047
Location
London
To make things easier to explain/understand I have 2 files similar to this:


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 :confused:

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:
Back
Top Bottom