• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 344
  • Last Modified:

php unserialize

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

$name

instead of

$myarray=unserialize($valueFromDB);

$myarray[name]

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

to

$name, $someothervalue

thanks

0
jackjohnson44
Asked:
jackjohnson44
  • 2
1 Solution
 
TeRReFCommented:
<?php
    $myarray = array('name'=>'namevalue', 'someothervar'=>'someonthervarvalue');
    foreach($myarray as $var=>$value) {
        $$var = $value;
    }
    print("vars:<br>".$name."<br>".$someothervar);
?>

0
 
jackjohnson44Author Commented:
nice, thanks a lot
0
 
TeRReFCommented:
You're welcome.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now