는 최근에 우리는 PHP 7PHP 7에서 참조로 전달할 수 있습니까?
에 PHP 5.6 마이그레이션 이제 다음 코드는 $this->a =& new test($this->f);
Parse error: syntax error, unexpected 'new' (T_NEW)
어떤 아이디어를 던져? 내가 그것을 사용할 수있는 대안은 무엇인가? PHP7 호환되지 않는 변경 사항에 따라
는 최근에 우리는 PHP 7PHP 7에서 참조로 전달할 수 있습니까?
에 PHP 5.6 마이그레이션 이제 다음 코드는 $this->a =& new test($this->f);
Parse error: syntax error, unexpected 'new' (T_NEW)
어떤 아이디어를 던져? 내가 그것을 사용할 수있는 대안은 무엇인가? PHP7 호환되지 않는 변경 사항에 따라
: http://php.net/manual/en/migration70.incompatible.php
New objects cannot be assigned by reference
The result of the new statement can no longer be assigned to a variable by reference:
<?php class C {} $c =& new C; ?>
Output of the above example in PHP 5:
Deprecated: Assigning the return value of new by reference is deprecated in /tmp/test.php on line 3
Output of the above example in PHP 7:
Parse error: syntax error, unexpected 'new' (T_NEW) in /tmp/test.php on line 3
가 대안이 없습니다. 더 이상 사용되지 않는 동작을 사용하고 있었고 더 이상 유효한 PHP가 아닙니다. 참조로 지정하지 마십시오. 그냥이
$this->a = new test($this->f);
처럼 앰퍼샌드를 제거 :