欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP通過(guò)引用傳遞參數(shù)用法分析

 更新時(shí)間:2016年12月01日 09:17:58   作者:牛逼的霍嘯林  
這篇文章主要介紹了PHP通過(guò)引用傳遞參數(shù)用法,結(jié)合具體實(shí)例分析了php函數(shù)參數(shù)中使用引用進(jìn)行參數(shù)傳遞的功能與操作技巧,需要的朋友可以參考下

本文實(shí)例講述了PHP通過(guò)引用傳遞參數(shù)用法。分享給大家供大家參考,具體如下:

先看一個(gè)手冊(cè)上的示例:

<?php
function add_some_extra(&$string) // 引入變量,使用同一個(gè)存儲(chǔ)地址
{
  $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.

如果沒(méi)有這個(gè)&符號(hào),

<?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,

更多關(guān)于PHP相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《php常用函數(shù)與技巧總結(jié)》、《php面向?qū)ο蟪绦蛟O(shè)計(jì)入門教程》、《PHP數(shù)學(xué)運(yùn)算技巧總結(jié)》、《PHP數(shù)組(Array)操作技巧大全》、《PHP數(shù)據(jù)結(jié)構(gòu)與算法教程》、《php程序設(shè)計(jì)算法總結(jié)》、《php正則表達(dá)式用法總結(jié)》及《php常見數(shù)據(jù)庫(kù)操作技巧匯總

希望本文所述對(duì)大家PHP程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論