雌雄大挪移,2013河南省考面试名单,金立手机主题下载 免费
本文实例讲述了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面向对象程序设计入门教程》、《php数学运算技巧总结》、《php数组(array)操作技巧大全》、《php数据结构与算法教程》、《php程序设计算法总结》、《php正则表达式用法总结》及《php常见数据库操作技巧汇总》
希望本文所述对大家php程序设计有所帮助。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
PHP date_default_timezone_set()设置时区操作实例分析
网友评论