引用不是什么

引用不是指针。

<?php

/**
 * References are not pointers.
 *
 * @param  string &$string
 * @return void
 */
function foo(string &$string)
{
    $string = &$GLOBALS['bar'];
}

$foo = 'foo';
$bar = 'bar';
foo($foo);

results matching ""

    No results matching ""