Your Open Source

 
Related Links

PHP

serialize() and unserialize() in php

serialize() and unserialize() :-

Serialize :- This is useful for storing or passing PHP values around without
losing their type and structure. For example stored the data like session data. The stored the data format like
a:1:{s:5:"title";s:71:"This is simple example of the serialize and unserialize function in php";} 


Unserialize :- single serialized variable and
converts it back into a PHP value and return real PHP array.

Example :-

$_POST['title']="This is simple example of the serialize and unserialize function in php";
$SerializeStr=serialize($_POST);
print_r("Serialize:- ".$SerializeStr);
echo "Unserialize:- ";
print_r(unserialize($SerializeStr));

Output:-

Serialize:- a:1:{s:5:"title";s:71:"This is simple example of the serialize and unserialize function in php";}

Unserialize:- Array
(
[title] => This is simple example of the serialize and unserialize function in php
)



 

  • hits 121
  • datetime Dec 11 09 05:53:32
  • author Sekar
  • rating

Rating : 12345

Comments


bharanikumar
Feb 07 10 11:05:42
Such a nice example

Quick Reply or Comments

Preview
Your Name:
Your Reply :
<> is a code tag
Enter the verification code: