php5 值赋值与引用赋值
值赋值――2个变量有各自的内存,互不影响
$str1 = "wang"; $str2 = $str1; $str1 = "zhang"; echo $str2; // wang
$i = "zhao"; $j = "wang"; $j = &$i; echo $j; // zhao $j = "hello,$j"; echo $j; //hello,zhao echo "<br/>"; echo $i; //hello,zhao
<?php $foo = 25; $bar = &$foo; // This is a valid assignment. $bar = &(24 * 7); // Invalid; references an unnamed expression. function test() { return 25; } $bar = &test(); // Invalid. ?>