i have an example that looks like this:

index.php

$variable = "something for the beggining";

// now i include file (but i cannot use the INCLUDE function)...
implode ('', file ('FILE.php));

FILE.php

// that doesn't work!!!
echo $variable;
  • is there any way to use the variable created in index.php in FILE.php without setting a cookie, creating session or moving it into FILE.php via address (FILE.php?variable=$variable)???

  • it would be also much better if i could use INCLUDE function, the only thing is, i need that file to return a string, not in the way include() function does.

any ideas? please help...

-thank you all 😉

    Well, if $SESSION, $GET, $COOKIE, are ruled out, what about $POST???

    And, then, I guess you could have script 1 write the variable down in a 3rd file, and have script 2 read it, but that's essentially a "session," right?

      $_POST ruled out too!

      • the reason why i can't use include function is, becuase i don't output anything with echo or print but i save everything in a variable $template.. and if i do include function before the final echo $template, then the FILE won't be on the place where i want it to be..
        Write a Reply...