Home >Backend Development >PHP Tutorial >有返回值的函数_PHP

有返回值的函数_PHP

WBOY
WBOYOriginal
2016-06-01 12:40:501016browse


有返回值的函数




function makeBold($inputText)//定义function makeBold()函数
{
$boldedText = "";
$boldedText .= $inputText;
$boldedText .= "
";
return($boldedText);//返回变量$boldedText
}
print("这行没有加重!!!
\n");//直接打印字符串
print(makeBold("这行被加重了!!!") . "
\n");//调用function makeBold()函数
print("这行没有加重!!!
\n");//直接打印字符串
?>


Statement:
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