function serialize


serializePHP ManualPrevNextserializeserialize -- Generates a storable representation of a value. Descriptionstring serialize(mixed value); serialize() returns a string containing a byte-stream representation of value that can be stored anywhere. This is useful for storing or passing PHP values around without losing their type and structure. To make the serialized string into a PHP value again, use unserialize(). serialize() handles the types integer, double, string, array (multidimensional) and object (object properties will be serialized, but methods are lost). Example 1. Serialize() example 1  2 // $session_data contains a multi-dimensional array with session 3 // information for the current user. We use serialize() to store 4 // it in a database at the end of the request. 5  6 $conn = odbc_connect ("webdb", "php", "chicken"); 7 $stmt = odbc_prepare ($conn, 8  "UPDATE sessions SET data = ? WHERE id = ?"); 9 $sqldata = array (serialize($session_data), $PHP_AUTH_USER); 10 if (!odbc_execute ($stmt, &$sqldata)) { 11  $stmt = odbc_prepare($conn, 12  "INSERT INTO sessions (id, data) VALUES(?, ?)"); 13  if (!odbc_execute($stmt, &$sqldata)) { 14  /* Something went wrong. Bitch, whine and moan. */ 15  } 16 } 17  PrevHomeNextregister_shutdown_functionUpsleep

Wyszukiwarka

Podobne podstrony:
function serialize
function serialize
function wddx serialize value
function wddx serialize vars
function wddx serialize value
function wddx serialize vars
function wddx serialize value
function wddx serialize vars
function fdf next field name
function ccvs void
function mysql error
function mcal event set end
function mcrypt cbc

więcej podobnych podstron