PHP serialize() function

Description

We can use serialize() to save objects into a string, then use urlencode() to get a format suitable for the web.

Syntax

PHP serialize() has the following syntax.

serialize($aVariable);

Example

Serialize a class


<?PHP//ww w  . ja  v  a  2 s  . c o m
class ComputerBook{ }
$aBook = new ComputerBook;
$safepoppy = urlencode(serialize($aBook));
?>




















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions