Correcting teacher:Guanhui
Correction status:qualified
Teacher's comments:写的过于简洁了,一定要认真完成!
$str = 'String';
echo 'this is a $str hello';
echo 'this is a ' . $str . ' hello';
echo 'hello \n\r world';
echo 'php.\'cn\'';
echo 'php."cn"';
echo 'php."cn"\\';
echo "this is a $str";
echo "this is a ${str}123";
echo "hello \n\r world";
echo "hello \n\r world\\";
$hello = 'php.cn';
echo <<< HELLO
hello <span style="color:red">$hello</span>
HELLO;
printf('hello %s', 'world');
printf('price: %d', 99);
vprintf('SELECT * FROM `%s` LIMIT %d', ['staffs', 20]);
$sql = sprintf('SELECT * FROM `%s` LIMIT %d', 'staffs', 30);
echo $sql;
file_put_contents('temp.txt', $sql);
$sql = vsprintf('SELECT * FROM `%s` LIMIT %d', ['staffs', 34]);
echo $sql;
file_put_contents('temp.txt', $sql);
echo implode('--', ['html', 'css', 'js', 'php']);
print_r(explode(', ', 'localhost, root, root, uft8, 3306'));
list($host, $username, $password) = explode(', ', 'localhost, root, root, uft8, 3306', 4);
echo "host={$host}, username={$username}, password={$password}";
echo str_repeat('---|', 10);
echo str_replace('php', '*', 'php.cn,php,thinkphp', $count);
$search = ['交友', '广告', '直播', '网红'];
echo str_replace($search, ['***', '===', '&&&', '+++'], '广告代理,直播在线,交友互动,网红大咖');
$str = ' this is a string';
echo strlen(trim($str));
$str = '124484php.cn php中文网 this is ljljl444812';
echo trim($str, '12');
echo trim($str, '1..9');
echo strpos('this is a test', 'is');
echo strstr('123456@qq.com', '@');
echo ltrim(strstr('123456@qq.com', '@'), '@');
echo strstr('123456@qq.com', '@', true);