Which of the following is a correct way to destroy a specific session variable in PHP?

  • unset($_SESSION['variable_name']);
  • session_destroy();
  • session_unset();
  • session_unset($_SESSION['variable_name']);
The correct way to destroy a specific session variable in PHP is by using the unset function, followed by the variable name in $_SESSION. This clears the variable without destroying the entire session.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *