超基本。
普通に。
$a = 'Test'; $b = $a; $a = 'Change'; echo "b: $b"; // b: Test
参照渡し。
$a = 'Test'; $b = &$a; $a = 'Change'; echo "b: $b"; // b: Change

超基本。
普通に。
$a = 'Test'; $b = $a; $a = 'Change'; echo "b: $b"; // b: Test
参照渡し。
$a = 'Test'; $b = &$a; $a = 'Change'; echo "b: $b"; // b: Change
test1.php
function foo() { global $color; $fruit = 'SUIKA'; include 'test2.php'; echo "A $color $fruit\n"; } for ($i=0; $i<100; $i++) { foo(); echo memory_get_usage() . "\n\n"; }
test2.php
$color = 'green'; $fruit = 'apple';
test1.php を実行したとき、メモリが増加する。
メモリ増加の原因は、ダブルクォーテーション内の変数展開であった。関数内のincludeはメモリを増やさない事がわかった。