The previous variables are reassigned new values.
Codeacula
2010-08-18 02:42:28
If it is just like you have it listed, then the $name
and $gender
variable's values are replaced with "ELENA" and "FEMALE"
Why don't you try, echo $name;
, echo $gender;
As Codeacula said, those variables will be overwritten. The opening and closing PHP tags do not define scope. Variables are in what's called the global scope unless they are inside of a function or class. Global methods are as the name implies available, and can be overwritten inside functions and classes
When a variable is inside of a function then that variable is only available inside of that function unless it is prepended with the keyword global
.
A quick search on google will give you more information on variable scope.