• Resolved jduffell

    (@jduffell)


    I’m trying to handle the contents of an array, before I store the array within a session the array outputs as follows;

    Array
    (
        [0] => yes
        [1] => no
    )

    However after storing in $wp_session[‘test_array’] it outputs like;

    Recursive_ArrayAccess Object
    (
        [container:protected] => Array
            (
                [0] => yes
                [1] => no
            )
    
        [dirty:protected] => 1
    )
    

    Is there any advise on returning the array to it’s original format so I can handle it easily.

    Thanks JD

Viewing 2 replies - 1 through 2 (of 2 total)
  • Could you serialize() the array before you store it, and unserialize() it when you retrieve it.

    Thread Starter jduffell

    (@jduffell)

    @lorro, cheers, very straight forward, I was certainly trying to overcomplicate it. Thanks for pointing me in the right direction.

    ^JD

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Storing array in session’ is closed to new replies.