Entry
how can i define variable
Jul 10th, 2003 10:54
Philip Olson, fakhruddin josawa,
A pretty vague question :) There are a million ways to define
variables, for example:
$foo = "somevalue";
echo $foo;
http://www.php.net/language.variables
Or, let's say you want to define a variable through the HTTP request,
like through GET:
http://www.example.com/yourscript.php?bar=somevalue
echo $_GET["bar"];
http://www.php.net/variables.external
Or maybe a cookie:
setcookie("baz", "some value", time()+424242);
echo $_COOKIE["baz"];
http://www.php.net/setcookie
Or maybe you're a little confused about variable scope in PHP (you
wouldn't be the first), consider this manual page:
http://www.php.net/variables.scope
The manual discusses various ways to define variables, so be sure to
read the manual.