how to pass variables between 2 php pages when the latter called with require() -


i php newbie, , have question:

say have:


a.php:

$a = 'foo' ; $b = 'baz' ; require ('b.php') ; 

how pass variables $a , $b b.php ? how use these variables in b.php ?

thanks lot !!

just make sure call require() after setting variables, , should available in b.php.

a.php:

$a = 'foo'; $b = 'baz'; require('b.php'); 

b.php:

echo 'a: '. $a; echo 'b: '. $b; 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -