how to run include() inside a function - PHP

Custom / CUSTOM
February 11, 2010 at 05:06:53
Specs: Windows XP, 8g
Hi, I'm trying to run a include() inside a function but it doesn;t seem to
work, as if its just skipping over the command. My script is below.

-- CODE ---



function turn(){


--- /CODE ---

See More: how to run include() inside a function - PHP

Report •

February 15, 2010 at 18:53:06

this looks like connect.php is a database connection script?

If either of those 2 includes in the function below call a
variable thats from within connect.php you will need to juse

global $variableName;

inside turn(); SEO Agency & Web Design Agency

Report •

April 30, 2010 at 18:28:27
The includes will just drop the contents in-line in the code, as if you had typed them into the outer file. They will not run any functions. As @Jamie said, you also have to pay attention to variable scoping, and use global varnames; within functions so that the functions can see other variables.

Report •

Related Solutions

Ask Question