I'm totally newbie, and this is maybe most silly question ever, but please help.
I got some PHP lines like this:
$var1 = 1;
if($var==1){
echo 'yes';
}
I got message: "Notice: Undefined variable".
Then if I add var before $var1, error thrown is: "Parse error: syntax error, unexpected T_VAR".
If I hide notice message by statement
error_reporting (E_ALL ^ E_NOTICE);, then no message shown, but the variable $var1 is not declared and assigned expected value - nothing is displayed.
So, what is the correct and easy way to declare a variable?
I'm running WampServer 2.1a
Thanks a lot.


Sign In
Create Account

Back to top









