Title: simpleSessionSet($key, array());
Last modified: August 21, 2016

---

# simpleSessionSet($key, array());

 *  Resolved [Cristiano](https://wordpress.org/support/users/iclapton/)
 * (@iclapton)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/simplesessionsetkey-array/)
 * Hi friends,
 * What should I do to work with array() for session $value?
 * My session should be: $_SESSION[‘hashed_urls’][$_url]=$value;
    How to set it 
   using Simple Session Support plugin?
 * Thanks!
    Cristiano
 * [http://wordpress.org/plugins/simple-session-support/](http://wordpress.org/plugins/simple-session-support/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Jules Colle](https://wordpress.org/support/users/jules-colle/)
 * (@jules-colle)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/simplesessionsetkey-array/#post-4276052)
 * I needed the same thing (looks like I’m the most active user of this plugin..:))
 * I modified the Get and Set functions like so:
 *     ```
       function simpleSessionGet($key, $default='') {
           if(isset($_SESSION[$key])) {
               return unserialize($_SESSION[$key]);
           } else {
               return $default;
           }
       }
       ```
   
 *     ```
       function simpleSessionSet($key, $value) {
           $_SESSION[$key] = serialize($value);
       }
       ```
   
 * The trick is to save all data serialized in the session, and unserialize it again
   when you need to retrieve it.
 * If you don’t like to modify the plugin code (even though I believe the code is
   more robust with my modifications), you could just call the functions like this:`
   simpleSessionSet($key, serialize($value))` and `unserialize(simpleSessionGet(
   $key))`
 * In you particular case
    `$_SESSION['hashed_urls'][$_url]=$value;` would be equivalent
   to `simpleSessionSet('hashed_urls', array($_url=>$value));` if you used the modified
   plugin code.
 *  Plugin Author [Peter Wooster](https://wordpress.org/support/users/pkwooster/)
 * (@pkwooster)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/simplesessionsetkey-array/#post-4276069)
 * Thanks Jules,
 * Serialization is the way to go, I’ll probably add it as an option in the next
   release. I just completed testing everything for WP 3.8, but I will be making
   updates to my plugins.
 * /peter
 *  [ianarmstrong](https://wordpress.org/support/users/ianarmstrong/)
 * (@ianarmstrong)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/simplesessionsetkey-array/#post-4276079)
 * This is such an easy change to make, I’m not sure why you haven’t just pushed
   it.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘simpleSessionSet($key, array());’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/simple-session-support.svg)
 * [Simple Session Support](https://wordpress.org/plugins/simple-session-support/)
 * [Support Threads](https://wordpress.org/support/plugin/simple-session-support/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-session-support/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-session-support/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-session-support/reviews/)

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [value](https://wordpress.org/support/topic-tag/value/)

 * 3 replies
 * 4 participants
 * Last reply from: [ianarmstrong](https://wordpress.org/support/users/ianarmstrong/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/simplesessionsetkey-array/#post-4276079)
 * Status: resolved