index.php
session_start() class Boo{ public $pub=100; } $obj=new Boo; $array=array("name"=>"fozi",189); $types=serialize($array); $obj_ser=serialize($obj); $_SESSION['obj']=$obj_ser; $_SESSION['arr']=$types;
mother.php
session_start(); class Boo{ public $pub=100; } $obj=unserialize($_SESSION['obj']); $arr= unserialize($_SESSION['arr']); echo $arr[0]; echo $obj->pub;
Reading the documentation:
If an application uses sessions and the session_register () function to register objects, these objects are automatically serialized at the end of each PHP page execution, and de-serialized automatically at the start of each of the following pages. This means that these objects can appear on any of the pages of the application, once they become part of a session. However, the session_register () function is removed in PHP 5.4.0.
I understand correctly that you can access objects without this serialization? How?