我要试试。。。
在第二个示例中:
for($i = 0; $i < 5; $i++) {
$r = 15;
$num = &$i; // now $num and $i are the same thing - perfectly legitimate
$t = $num + $r; // equivalent to $t = $i + $r
array_push($a, $t);
}
在第一个例子中:
for($i = 0; $i < 5; $i++) {
$r = 15;
$t = &$i + $r; // $t and $i are the same thing. $r is not involved
$t = &$i * "anything you want"; // this does exactly the same thing
array_push($a, $t);
}
请注意
in the documentation
,这些类型的作业是这样写的
$t =& $i
,我认为这是一个有用的提醒,你只是在
二
同一句话中的东西和其他任何东西都是不相关的。