English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Hi,

I am new to PHP. Can anyone provide me with a quick example of how to set a variable that a function can use (any function would be good).

Thanks.

2006-06-25 17:08:18 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers


$var = "something";

function bla_bla() {
global $var;

echo $var; // this will echo "something"
};

?>

Notice the "global $var;" line? That tells the function that whenever you use that variable in the function, it will look for it in the global scope, outside the function :)

2006-06-26 01:07:54 · answer #1 · answered by mano_cornuto83 1 · 0 0

Good Learn my friend this below link is just what you need

http://www.chrisjdavis.org/2005/10/16/php-in-css/

2006-06-26 06:13:42 · answer #2 · answered by Joe_Young 6 · 0 0

Well, you can better look for anything like this in www.php.net and... RTFM! That's how I learned PHP, and trust me, it does work :)

2006-06-26 00:12:12 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers