关于PHP函数的用法
<?phpfunctionfoo(){echo"Infoo()<br/>\n";}functionbar($arg=''){echo"Inbar();argumentwa...
<?php
function foo() {
echo "In foo()<br />\n";
}
function bar($arg = '') {
echo "In bar(); argument was '$arg'.<br />\n";
}
// This is a wrapper function around echo
function echoit($string)
{
echo $string;
}
$func = 'foo';
$func(); // This calls foo()
$func = 'bar';
$func('test'); // This calls bar()
$func = 'echoit';
$func('test'); // This calls echoit()
?>
------------------------
为什么前面的func('test')调用bar(),而后面的func('test')调用echoit()
写错了,问题是:
为什么前面的$func('test')调用bar(),而后面的$func('test')调用echoit() 展开
function foo() {
echo "In foo()<br />\n";
}
function bar($arg = '') {
echo "In bar(); argument was '$arg'.<br />\n";
}
// This is a wrapper function around echo
function echoit($string)
{
echo $string;
}
$func = 'foo';
$func(); // This calls foo()
$func = 'bar';
$func('test'); // This calls bar()
$func = 'echoit';
$func('test'); // This calls echoit()
?>
------------------------
为什么前面的func('test')调用bar(),而后面的func('test')调用echoit()
写错了,问题是:
为什么前面的$func('test')调用bar(),而后面的$func('test')调用echoit() 展开
1个回答
TableDI
2024-07-18 广告
2024-07-18 广告
仅需3步!不写公式自动完成Excel vlookup表格匹配!Excel在线免,vlookup工具,点击16步自动完成表格匹配,无需手写公式,免费使用!...
点击进入详情页
本回答由TableDI提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询