Question: I have the following problem: in index.php, I have set the variable $activelang. I

```
$activelang = active_language (); 
echo $activelang; //works perfectly 

```

Later in my index.php code, I include a new php file. 

```
include ('myotherfile.php');

```

If I try to use $activelang in myotherfile.php, it does not work! I am not using it inside a function, and I tried using global $activelang and it doesnt work either

All of these is happening in a wordpress install, but the code I am talking about is plain php. I am using php 5.3

Why is this happening? As I undestand it, the include works as a copy paste in my main file, so I shouldnt be having any problems with variable scope, right?

Answer: 
include should be used to include **files**, not some network resources.

if you bother to run **the code you posted here** you'll be surprized, as it will print $activelang all right.
When working with WordPress templates you should create functions in your functions.php file for handling includes and then call those functions in your templates.

So in functions.php you should have:

```
function myOtherFile() {

    include('myotherfile.php');

}

```

And in index.php call myOtherFile()

Now, if you still have trouble with scope try this:

```
function myOtherFile($activelang) {

    include('myotherfile.php);

}

```

And then in index.php do this:

```
$activelang = active_language();

myOtherFile($activelang);

```

If that doesn't work then I think your problem is being caused elsewhere. Because like Col. Shrapnel said, the code you posted here works.