How to resolve an exception that occurs when using unset ()

Source: Internet
Author: User
How to resolve errors that occur when using unset ()
PHP Code
  
   
  
   ", $user);        Unset ($user);    printf ("Username now set to:%s
", $user);? >


Why unset () shows notice:undefined variable:user in D:\Apache group\apache2\htdocs\phpproject\index3.php on line 30:


Find out about the function of the session will be some error hints ...

------Solution--------------------
Sorry I didn't look at your code!
Unset ($user); This clears the variable named user from the variable table, so the next line of code will appear $user undefined, and you won't even know what unset () is.
printf ("Username now set to:%s
", $user);
------Solution--------------------
The statement behind the unset, you're testing it, right? That's the right thing to do, but it's not the right hint.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.