Only variable references should be returned by reference :
Consider the following example :
<?php
class myClass {
public $var = 1;
public function &getVar() {
return($this->var);
}
}
$obj = new myClass;
$value = &$obj->getVar();
?>
The above example should arise the error,
To solve it like below code:
<?php
class myClass {
public $var = 1;
public function &getVar() {
return $this->var;
}
}
$obj = new myClass;
$value = &$obj->getVar();
?>
Another Easiest Example is given below :
return $this->auth ? $this->ehlo() : $this->helo();
Change the above line to below one.
$return
= $this->auth ? $this->ehlo() : $this->helo();
return $return;
By
0 comments:
Post a Comment