Quantcast
Viewing latest article 34
Browse Latest Browse All 37

Answer by Mohamed Mufeed for PHP pass variable to include

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 latest article 34
Browse Latest Browse All 37

Trending Articles



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