Renard Fin
10-18-2006, 04:09 PM
Anyone here uses the php class stdClass ?
I saw it is an empty class so I too it for storing my user parameters doing something like
class session extends Controller
{
function __construct()
{
session_start();
if (isset($_SESSION['userdata']))
{
$this->user = unserialize($_SESSION['userdata']);
}
else
{
$this->user = new stdClass;
$this->user->uid = 0;
}
}
function __destruct()
{
$_SESSION['userdata'] = serialize($this->user)
}
Should this be modified to use an empty class I create ? something like
class user { }
I have read a bit on php6, they were suggesting to remove the native php classes like stdClass() and incompleteClass();
Any thougths on this, is this the correct way to do "clean" php code or should I modify this ?
I saw it is an empty class so I too it for storing my user parameters doing something like
class session extends Controller
{
function __construct()
{
session_start();
if (isset($_SESSION['userdata']))
{
$this->user = unserialize($_SESSION['userdata']);
}
else
{
$this->user = new stdClass;
$this->user->uid = 0;
}
}
function __destruct()
{
$_SESSION['userdata'] = serialize($this->user)
}
Should this be modified to use an empty class I create ? something like
class user { }
I have read a bit on php6, they were suggesting to remove the native php classes like stdClass() and incompleteClass();
Any thougths on this, is this the correct way to do "clean" php code or should I modify this ?
