Home > php教程 > php手册 > body text

PHP中数组,字符串和对象的在方法中的引用方式

WBOY
Release: 2016-06-06 19:44:37
Original
1184 people have browsed it

读了几篇关于PHP方法调用参数,是传还是传引用的文章: http://blog.51yip.com/php/878.html http://www.cnblogs.com/zcy_soft/archive/2011/12/10/2283570.html 非常有趣的是,当方法调用的是对象是,传入的是引用。 而与Java不同的是,数组默认是传递,如

读了几篇关于PHP方法调用参数,是传值还是传引用的文章:


http://blog.51yip.com/php/878.html

http://www.cnblogs.com/zcy_soft/archive/2011/12/10/2283570.html


非常有趣的是,当方法调用的是对象是,传入的是引用。

而与Java不同的是,数组默认是值传递,如果加了”&“符号,那么就变成了引用传递。

顺便测试了字符串,结果与数组相同。


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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!