All pastes #518453 Raw Edit

Someone

public php v1 · immutable
#518453 ·published 2007-05-29 09:49 UTC
rendered paste body
<?phpecho '<PRE>';$config = Array(	'username' => 'wrs',	// username ( string )	'accesslevel' => 3,	// access level ( integer )	'showemail' => false,	// some other var ( boolean ));var_dump($config);// With serialize() we can convert this entire PHP array in to one string, which can be written to file/database for later retrieval$data = serialize($config);// $data should now be something like:// a:3:{s:8:"username";s:3:"wrs";s:11:"accesslevel";i:3;s:9:"showemail";b:0;}echo $data."\n";// which can easily be saved to file/database// to get our array back$newconfig = unserialize($data);var_dump($newconfig);// contents of $config and $newconfig should be exactly the same.?>