Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
function hello(): string
{
global $name;
return 'Hello, ' . $name;
}
return 'Hello, ' . $GLOBALS['name'];
$name = '老师456';
$hello = function () use ($name): string
{
return 'Hello, ' . $name;
};
echo $hello() , '<hr>';
$name = '老师222';
$hello = function ($name): string
{
return 'Hello, ' . $name;
};
echo $hello($name) , '<hr>';
//ucwords 首字母转大写
$str="wo ai zhong guo";
$str=ucwords($str);
echo $str . '<hr>';
//strrev反向输出内容
$str="wo ai zhong guo";
$str=strrev($str);
echo $str . '<hr>';
//ucfirst 转为大写第一个字母
$str="wo ai ZHong GUO";
$str=ucfirst($str);
echo $str . '<hr>';
//lcfirst 转为小写第一个字母
$str="WO ai ZHong GUO";
$str=lcfirst($str);
echo $str . '<hr>';
//strtolower 全部转为小写输出
$str="WO ai ZHong GUO";
$str=strtolower($str);
echo $str . '<hr>';
//strtoupper 全部转为大写输出
$str="wo ai zHong GUO";
$str=strtoupper($str);
echo $str . '<hr>';
`