<?php
str public ArrayObject::serialize ( void )
?>
<?php
$Dwarfs = [ 1 => 'Bashful', 2 => 'Doc',
3 => 'Grumpy', 4 => 'Happy',
5 => 'Sneezy', 6 => 'Sleepy', 7 => 'Dopey',
8 => 'Snow White'];
$dwArrayObject = new ArrayObject($Dwarfs);
$str01 = serialize($dwArrayObject);
$str02 = $dwArrayObject->serialize();
echo $str01 . '<br><br>' . $str02;
?>
<?php
class Dwarfs
{
const MYARRAY = [ 1 => 'Bashful', 2 => 'Doc',
3 => 'Grumpy', 4 => 'Happy',
5 => 'Sneezy', 6 => 'Sleepy', 7 => 'Dopey',
8 => 'Snow White'];
public static function serialz()
{
return serialize(self::MYARRAY);
}
}
var_dump(Dwarfs::serialz());
?>