-
Jun 26th, 2014, 01:46 PM
#1
Thread Starter
Don't Panic!
[RESOLVED] PHP - Clearing up variables
Hi
Another quick and easy question.
Once I'm at the bottom of the php file, so I need to unset any/all the variables I used ?
Also, if I destroy a session, will that clear the session variables as well ?
Just curious, and want to try to get into some good practices...
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Jun 27th, 2014, 12:43 AM
#2
Re: PHP - Clearing up variables
Use unset more info on google
http://www.php.net/manual/en/function.session-unset.php
Example
Originally Posted by mwgamera
PHP Code:
<?php session_start(); var_dump($_SESSION); $a =& $_SESSION; unset($_SESSION); $a['x'] = 1; // $a refers to the original $_SESSION $_SESSION['x'] = 2; // new unrelated array session_write_close(); // saved session contains x => 1 ?>
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Jun 27th, 2014, 09:12 PM
#3
Re: PHP - Clearing up variables
Originally Posted by Ecniv
Hi
Another quick and easy question.
Once I'm at the bottom of the php file, so I need to unset any/all the variables I used ?
Also, if I destroy a session, will that clear the session variables as well ?
Just curious, and want to try to get into some good practices...
Vince
It is not necessary to unset all of your variables from your page.
When you destroy a session, all session variables are... destroyed, so they no longer exist.
Originally Posted by Nightwalker83
Your post didn't answer any question the OP asked.
-
Jun 29th, 2014, 05:12 PM
#4
Thread Starter
Don't Panic!
Re: PHP - Clearing up variables
Thanks
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|