PHP Setting Normal Variables Changing Session Variables

I just suddenly starting having the weirdest problem I’ve ever seen, and nothing has changed except the host of my site. I use a lot of $_SESSION variables in my code that might have the same name as a normal variable, but setting the normal variable seems to be changing the $_SESSION variable with the same name.

For example, if I do

$_SESSION['favcolor'] = 'blue';
$favcolor = 'green';
echo $_SESSION['favcolor'];

I get green as the response… How do I not let this happen? I figure there’s most likely some PHP ini variable that must be changed but I can’t seem to find anything on this…

Leave a Reply


Hire Me
Follow Me!
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.