Variable confusion
Posted: Fri Nov 11, 2016 3:31 am
Is it possible that variables are not always case sensitive? When I moved my website from the local environment to the web server, a lot of things stopped working and had to be fixed. Among one of the things was that I had assigned variables $userid and $charid and then tried to address them as $userId and $charId, with the Id starting with a capital letter. Yet it appears that that somehow worked locally, because it certainly didn't fail like it did online.
Also, in a lot of places I was referring a variable as $userid which wasn't defined anywhere on the page, (the actual name of the variable was $currentUser) yet somehow it never failed to work. The value of the variable was placed in a hidden field in a form, and if the next page didn't have the GET variable then it should fail. Yet somehow it was working. It totally blows my mind. It must've been getting the $userid definition from somewhere but I can't see how or where. Um, is it possible that something in some versions of php automatically converts GET information into variables with the same name? That's the only explanation I could think of. Maybe this is far fetched but I am totally baffled about how it's even vaguely possible the code was working in the first place with all the bugs.
Also, in a lot of places I was referring a variable as $userid which wasn't defined anywhere on the page, (the actual name of the variable was $currentUser) yet somehow it never failed to work. The value of the variable was placed in a hidden field in a form, and if the next page didn't have the GET variable then it should fail. Yet somehow it was working. It totally blows my mind. It must've been getting the $userid definition from somewhere but I can't see how or where. Um, is it possible that something in some versions of php automatically converts GET information into variables with the same name? That's the only explanation I could think of. Maybe this is far fetched but I am totally baffled about how it's even vaguely possible the code was working in the first place with all the bugs.