Showing posts with label prithwiraj. Show all posts
Showing posts with label prithwiraj. Show all posts

Nov 5, 2010

PHP serialize() Function

serialize

(PHP 4, PHP 5)

serialize — Generates a storable representation of a value

 Description

string serialize ( mixed $value )

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().

 Parameters

value

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 __wakeupmember 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.

 Return Values

Returns a string containing a byte-stream representation of value that can be stored anywhere.

 Examples

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.. */
    
}
}
?>

 Changelog

VersionDescription
4.0.7The object serialization process was fixed.

 Notes

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.

Nov 4, 2010

Sometimes in the dream...

Sometimes in the dream I think of you...

You're so shapeless, that I can't assume you...

The night, the sleep and the silence when prevails

It's me who voyage, or it's someone else...

Mar 16, 2007

ISHITA L♥VES PRITHWIRAJ



Hi, I am Prithwiraj Bose. You may know me as Pom, Bultan, Prithwi and Raj. I am a resident of Simurali, a village at district Nadia, in West Bengal. For them who are out side from India, West Bengal is a beautiful state of India. I am doing B-Tech on Information Technology from Kalyani Government Enginering College. Before it, I completed my schooling from Chakdaha Model School, Ranaghat Palchowdhury Primary School and Kalyani University Experimental High School respectively.

And, my love is Ishita, Ishita Majumder or Tuki. The cute girl Tuki has always been a special part of my glee and sorrow. We felt love for each other two and half years back, when we was spending one of the golden moments of our lives, 'The School Life In Experimental'. A formal proposal wasn't needed for us to understand the words of eyes. We just got into love after then, and really don't know how and when the relation got the heavy strength to live a life-time. We are in deep love for each other. Tuki is my only dream that I pray to God to make true.

Ishita lives at Kalyani, West Bengal. She is a student of B-Sc (Hons.) in Electronics in Goria Andrew's College. She completed her schooling from Kalyani University Experimental Primary School and High School respectively.