PHP코드에서 종종 아래와 같은 코드를 봅니다.
function &__getController() { .... }
이리저리 검색해본 결과 혼자서는
static function __getController() { .... }
랑 같은거다!!
...라는 결론을 내렸는데.. 틀린건가요?
읽어주셔서 감사합니다. 좋은 하루 보내십시오.
http://stackoverflow.com/questions/1676897/what-does-it-mean-to-start-a-php-function-with-an-ampersand
OTL
그렇게 한참을 뒤졌는데 못찾겠더니.. ㅠㅠ 감사합니다.
<?php class foo { public $value = 42;
public function &getValue() { return $this->value; } }
$obj = new foo; $myValue = &$obj->getValue(); // $myValue is a reference to $obj->value, which is 42. $obj->value = 2; echo $myValue; // prints the new value of $obj->value, i.e. 2. ?>
http://uk2.php.net/manual/en/language.references.return.php
요거 한 방으로 이해 되네요.
-------------------------------------------- :: 누구보다 빠르게 남들과는 다르게
http://stackoverflow.com/questions/1676897/what-does-it-mean-to-
http://stackoverflow.com/questions/1676897/what-does-it-mean-to-start-a-php-function-with-an-ampersand
OTL 그렇게 한참을
OTL
그렇게 한참을 뒤졌는데 못찾겠더니.. ㅠㅠ
감사합니다.
<?php
class foo {
public $value = 42;
public function &getValue() {
return $this->value;
}
}
$obj = new foo;
$myValue = &$obj->getValue(); // $myValue is a reference to $obj->value, which is 42.
$obj->value = 2;
echo $myValue; // prints the new value of $obj->value, i.e. 2.
?>
http://uk2.php.net/manual/en/language.references.return.php
요거 한 방으로 이해 되네요.
--------------------------------------------
:: 누구보다 빠르게 남들과는 다르게