Can I share variables between different functions in PHP?

leechpa

New Member
I'll try to explain with an example...Let's say I have two different functions, and one of them has a defined variable. In the second function, I don't wanna write the same variable again, can I simply use the variable from the first function in the second one WITHOUT redefining it in the second function?Something like:\[code\]function a(){ $var = "my variable";}function b(){ echo $var;}\[/code\]Sorry if this questions is a bit silly, but I'm still a beginner =).
 
Back
Top