Quantcast
Channel: User Mohamed Mufeed - Stack Overflow
Viewing all articles
Browse latest Browse all 36

Answer by Mohamed Mufeed for PHP pass variable to include

$
0
0

The Option one if tweaked like this, it should also work.

The Original

Option One

In the first file:

global $variable; $variable = "apple"; include 'second.php'; 

In the second file:

echo $variable;

TWEAK

In the first file:

$variable = "apple"; include 'second.php';

In the second file:

global $variable;echo $variable;

Viewing all articles
Browse latest Browse all 36

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>