Can we use the same variable name in PHP which is used to GET the data. Example: Get variable is $_GET['V'], now can I use $V variable for some other purpose or it will lead to ambiguity?
4 Answers
$_GET['V'] and $V are in no way tied together and will occupy different memory. You can use both names.
If you change the default PHP configuration to enable register_globals, $V would be created as well as $_GET['V'] if such a query string parameter existed, but you could still overwrite it and use it as a separate variable.
register_globals has not been enabled in the default PHP configuration for several years.
Comments
1 Comment
Jatin Dhoot
Before PHP 4.2 it was set to on, this feature has been set to off by default since PHP 4.2.0, is DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.