Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

Making variables available within functions

Question posted by: Vernon Wenberg III (Guest) on March 15th, 2008 11:15 PM
How do I make variables available to functions?

Such as in the following ...

$var = 'value';

function bla() {

echo $var;

}
Michael Fesser's Avatar
Michael Fesser
Guest
n/a Posts
March 15th, 2008
11:45 PM
#2

Re: Making variables available within functions
..oO(Vernon Wenberg III)
Quote:
>How do I make variables available to functions?
>
>Such as in the following ...
>
>$var = 'value';
>
>function bla() {
>
> echo $var;
>
>}


The keyword is 'global'.

Micha

 
Not the answer you were looking for? Post your question . . .
189,071 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors