Home >Backend Development >PHP Tutorial >关于函数引用传递!该如何处理

关于函数引用传递!该如何处理

WBOY
WBOYOriginal
2016-06-13 10:08:48748browse

关于函数引用传递!
下面的2段代码结果一样,但是有什么不同呢?


PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php $string = 'string';     function change($str) {         $str = 'str';     }     change(&$string);     echo $string; ?>     <?php $string = 'string';     function change(&$str) {         $str = 'str';     }     change($string);     echo $string; ?> 


------解决方案--------------------
没用本质上的不同
不过自 php 5.3 起,前者已开列在淘汰之列
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn