I am working on a framework that uses register_globals. My local php version is 5.4.
I know register_globals is deprecated since PHP 5.3.0 and removed in PHP 5.4, but I have to make this code work on PHP 5.4.
Is there any way to emulate the functionality on newer versions of PHP?
You can emulate
register_globalsby using extract in global scope:Or put it to independent function using global and variable variables
If you have a released application and do not want to change anything in it, you can create
globals.phpfile withthen add auto_prepend_file directive to .htaccess (or in php.ini)
After this the code will be run on every call, and the application will work as though the old setting was in effect.