Serialize an ArrayObject with ArrayObject::serialize in PHP

Description

The following code shows how to serialize an ArrayObject with ArrayObject::serialize.

Example


//example revised from php.net/*ww w  .  ja  v a2s  .co  m*/
<?php
$o = new ArrayObject();

$s1 = serialize($o);
$s2 = $o->serialize();

var_dump($s1);
var_dump($s2);
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Data Types »




Array
Array Associative
Array Util
ArrayObject
Data Types
Date
Date Format
DateTime
Number
String
String Escape
String Filter
String HTML
String Type
Timezone