code?
July 8th, 2009, 11:45 AM
Can I set a variable to be a pointer/reference to a class?
<?php
class Data {}
$DataClass = Data;
$Data1 = new $DataClass;
?>
I'm not so good with pointer syntax, is it &?
Also, it's for something like this.
<?php
class A
{
public $B;
function __construct()
{
$this->B = &A_B;
}
}
class A_B
{
}
$A = new A();
$B = new $A->B();
?>
<?php
class Data {}
$DataClass = Data;
$Data1 = new $DataClass;
?>
I'm not so good with pointer syntax, is it &?
Also, it's for something like this.
<?php
class A
{
public $B;
function __construct()
{
$this->B = &A_B;
}
}
class A_B
{
}
$A = new A();
$B = new $A->B();
?>