[RESOLVED] About reference on PHP5

liunx

Guest
Hi anyOne.
In short words:
In php4 I was used to use this code:

class DataMailer
{
var $arrayProc;
function DataMailer(&$arrayProc)
{
$this->arrayProc= &$arrayProc;
}
}

I'm reading the php5 manual on php.net
and I'm wondering if in PHP5 I can use
this:


class DataMailer
{
var $arrayProc;
function DataMailer($arrayProc)
{//WITHOUT REFERENCE
$this->arrayProc= $arrayProc;
}
}

Do you agree ?
You know I'm learning OOP :D
Take care.In PHP5, objects are passed by reference, so the "&" reference operator isn't needed.
Value types (int, array, string, and things like that) are still passed by value.:)
 
Back
Top