Difference between session_register and $_SESSION[]

前端 未结 2 1035
走了就别回头了
走了就别回头了 2021-01-25 07:27

What is the difference between session_register() and $_SESSION array ?

相关标签:
2条回答
  • From the manual page for session_register:

    This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.

    There are differences (e.g., session_register accepts names of global variables, automatically starts the session, etc), but I think a sufficient answer is "don't use session_register" unless you really want to know the list of caveats for educational purposes.

    Just to elaborate on one point that makes session_register bad: it relies on global variables (and register_globals).

    0 讨论(0)
  • 2021-01-25 08:06

    session_register() is kinda old, already deprecated, but as I know it does the same thing.

    also all variables that start with $_ are included in $GLOBALS and are called superglobals

    0 讨论(0)
提交回复
热议问题