Generates a storable representation of a value.
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().
Anonymous user / 13.59.83.202 Log In Register |
?
Wallet:
3.00
Daily Credits:
1.20 / 1.20
|
This is your credit balance. Even if you are an anonymous user, you are given some credits to spend. Every IP address has its own account and it is provided with free credits that can be used to pay for Online Domain Tools services. Moreover, credit balance is reset every day. This is why we call them Daily Credits. Registered users have higher Daily Credits amounts and can even increase them by purchasing subscriptions.
Besides Daily Credits, all accounts, including IP address accounts of anonymous users, have their credit Wallet. Wallet credits are not reset on a daily basis, but they are only spent when a user has not enough Daily Credits. Registered users can buy credits to their wallets. All IP address accounts are created with an initial Wallet balance of 3.00. Once IP address account spends credits from its Wallet, it can not be charged again. This should allow new users to try most of Online Domain Tools services without registration.
Generates a storable representation of a value.
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().
The value to be serialized. serialize() handles all types, except the resource-type. You can even serialize() arrays that contain references to itself. Circular references inside the array/object you are serializing will also be stored. Any other reference will be lost.
When serializing objects, PHP will attempt to call the member function __sleep() prior to serialization. This is to allow the object to do any last minute clean-up, etc. prior to being serialized. Likewise, when the object is restored using unserialize() the __wakeup() member function is called.
Note:
Object's private members have the class name prepended to the member name; protected members have a '*' prepended to the member name. These prepended values have null bytes on either side.
Returns a string containing a byte-stream representation of
value
that can be stored anywhere.
Example #1 serialize() example
<?php
// $session_data contains a multi-dimensional array with session
// information for the current user. We use serialize() to store
// it in a database at the end of the request.
$conn = odbc_connect("webdb", "php", "chicken");
$stmt = odbc_prepare($conn,
"UPDATE sessions SET data = ? WHERE id = ?");
$sqldata = array (serialize($session_data), $_SERVER['PHP_AUTH_USER']);
if (!odbc_execute($stmt, $sqldata)) {
$stmt = odbc_prepare($conn,
"INSERT INTO sessions (id, data) VALUES(?, ?)");
if (!odbc_execute($stmt, $sqldata)) {
/* Something went wrong.. */
}
}
?>
Version | Description |
---|---|
4.0.7 | The object serialization process was fixed. |
Note:
Note that many built-in PHP objects cannot be serialized. However, those with this ability either implement the Serializable interface or the magic __sleep() and __wakeup() methods. If an internal class does not fulfill any of those requirements, it cannot reliably be serialized.
There are some historical exceptions to the above rule, where some internal objects could be serialized without implementing the interface or exposing the methods. Notably, the ArrayObject prior to PHP 5.2.0.