php unserialize

Posted on 2006-04-30
Last Modified: 2012-06-27
I have an form that I serialize and put into a db.

$customerInfo = myserialize($HTTP_POST_VARS);

I get it out and unserialize it.

I would like to access the origonal form variables like


instead of



so pretty much, how do you go from
$myarray[name], $myarray[someothervalue]


$name, $someothervalue


Question by:jackjohnson44
    LVL 29

    Accepted Solution

        $myarray = array('name'=>'namevalue', 'someothervar'=>'someonthervarvalue');
        foreach($myarray as $var=>$value) {
            $$var = $value;


    Author Comment

    nice, thanks a lot
    LVL 29

    Expert Comment

    You're welcome.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now