下一篇 » « 上一篇

Figure 2-3: Experimenting with Scope

作者:semirock    时间:2008-01-22    来源:http://444p.com    点击:29851    本文共1篇文章 字体:[ ]

Figure 2-3: Experimenting with Scope

<HTML>
<HEAD>
<TITLE>Figure 2-3</TITLE>
</HEAD>
<BODY>
<?
function printCity($NameOfCity)
{
print("The city is $NameOfCity.<BR>\n");
}

function California()
{
$capital = "Sacramento";
printCity($capital);
}

function Utah()
{
$capital = "Salt Lake City";
printCity($capital);
}

function Nation()
{
global $capital;
printCity($capital);
}

$capital = "Washington D.C.";

Nation();
California();
Utah();
Nation();

?>
</BODY>
</HTML>
责任编辑:semirock
发表评论
密码: (游客不需要密码)
记住我【Alt+S 或 Ctrl+Enter 快速提交】

搜索工具


《PHP函数》点击排行