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,zhaoecho "<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.?>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号