View Full Version : passing property as arg. to method???

07-31-2010, 03:20 AM
guys how to pass a property as an argument/parameter to a method in same class.
Coz i think this is not valid:

class A{
public $var=4;
function xyz($this->var){ // invalid way.


so is there a way that i can actually pass property to a method ???

07-31-2010, 08:32 AM
class A{

public $var;

function setVal($val){

$this->var = $val;



$obj = new A;