您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

PHP通过引用传递参数用法详解

2024/3/12 17:10:26发布19次查看
这篇文章主要介绍了php通过引用传递参数用法,结合具体实例分析了php函数参数中使用引用进行参数传递的功能与操作技巧,需要的朋友可以参考下
先看一个手册上的示例:
<?php function add_some_extra(&$string) // 引入变量,使用同一个存储地址 { $string .= 'and something extra.'; } $str = 'this is a string, '; add_some_extra($str); echo $str; // outputs 'this is a string, and something extra.' ?>
输出:
this is a string, and something extra.
如果没有这个&符号,
<?php function add_some_extra($string) { $string .= 'and something extra.'; } $str = 'this is a string, '; add_some_extra($str); echo $str; // outputs 'this is a string, ' ?>
输出:
this is a string,
以上就是本文的全部内容,希望对大家的学习有所帮助。
相关推荐:
php安全配置记录与常见错误梳理详解
php实现获取当前日期及本周一是几月几号的方法
php中str_pad()函数用法详解
以上就是php通过引用传递参数用法详解的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product