AnotherPoetsCry Posted January 18, 2007 Share Posted January 18, 2007 I have a list of variables that the users enter. i then serialize this list and save this to a table. can i unserialize this and get the variables back just as they were before i serialized them? for example $sellerLabel can still be called $sellerLabel after unserialization?[code] $options = serialize( $this->globalsInfo['options'] = array( 'notReady' => $this->globalsInfo['notReady'], 'sellerLabel' => $sellerLabel, 'minP' => $minP, 'minPName' => $minPName, 'maxP' => $maxP, 'maxPName' => $maxPName, 'buyerLabel' => $buyerLabel, 'minQ' => $minQ, 'minQName' => $minQName, 'demand' => $demand, 'demandName' => $demandName, 'value' => $value, 'valueBuyersName' => $valueBuyersName, 'valueSellersName' => $valueSellersName, 'cost' => $cost, 'costBuyersName' => $costBuyersName, 'costSellersName' => $costSellersName, 'prob' => $prob, 'probName' => $probName, 'forceFix' => $forceFix, 'displayAllProfits' => $displayAllProfits, 'test' => $test, 'testDelay' => $testDelay ) ); [/code][code]$this->globalsInfo['options'] = unserialize( $this->globalsInfo['options'] );foreach( $this->globalsInfo['options'] as $key => $value ) $this->$key = $value;[/code] Quote Link to comment Share on other sites More sharing options...
fenway Posted January 19, 2007 Share Posted January 19, 2007 I'm not sure I understand. Quote Link to comment Share on other sites More sharing options...
artacus Posted January 19, 2007 Share Posted January 19, 2007 PHP question not a MySQL question, mysql is just storing it as text.But to answer your question, no. Serialize only stores the value of the variable. So to restore it to the same name you would have to also store the name in a variable before you serialize it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.