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

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

WBOY
Release: 2016-06-13 10:08:48
Original
752 people have browsed it

关于函数引用传递!
下面的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; ?> 
Copy after login


------解决方案--------------------
没用本质上的不同
不过自 php 5.3 起,前者已开列在淘汰之列
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template