PHP unserialize()

📔 : PHP 🔗

unserialize() function , serialized data को un-serialize करके उसे PHP Value में convert करता है। या कह सकते हैं stored representation data को PHP Value में convert करता है।

यह function , serialize() function के just apposite काम करता है।

PHP unserialize Syntax

unserialize ( string $data , array $options = [] );
  1. string $data | required : यह serialized string data है जिसे हम un-serialize करना चाहते हैं।

  2. array $options | optional : यह optional में आप Associative Array pass कर सकते है , allowed_classes => true / false pass किया जाता है। By Default true ही होता है जिसका मतलब classes allowed हैं। और false का मतलब कोई भी class allowed नहीं है।

File : php_unserialize.php

Copy Fullscreen Close Fullscreen
  $var = ['name' => 'rahul Kumar', 'age' => 24];
  $data = serialize($var);
  echo $data ."br>";
  /*now un-serialized it*/
  print_r( unserialize($data) );
a:2:{s:4:"name";s:11:"rahul Kumar";s:3:"age";i:24;}
    [name] => rahul Kumar
    [age] => 24

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook