Easy Tutorial
❮ Func Filesystem Fileowner Php Namespace ❯

PHP serialize() Function

PHP Available Functions

The serialize() function is used to serialize objects or arrays and returns a string.

After serializing an object with the serialize() function, it can be easily passed to other places where it is needed, and its type and structure will not change.

If you want to convert a serialized string back to a PHP value, you can use unserialize().

PHP Version Requirements: PHP 4, PHP 5, PHP 7

Syntax

string serialize ( mixed $value )

Parameter Description:

Return Value

Returns a string.

Example

<?php
$sites = array('Google', 'tutorialpro', 'Facebook');
$serialized_data = serialize($sites);
echo  $serialized_data . PHP_EOL;
?>

Output:

a:3:{i:0;s:6:"Google";i:1;s:6:"tutorialpro";i:2;s:8:"Facebook";}

PHP Available Functions

❮ Func Filesystem Fileowner Php Namespace ❯