echo()函数输出一个或多个字符串。

wufei123 发布于 2023-08-21 阅读(1050)

PHP中的echo()函数


注意 - echo()函数比print()函数更快。

语法

1

echo(str)

参数

  • str − 要发送到输出的字符串

返回值

echo()函数不返回任何内容。

示例

以下是一个示例:−

在线演示

1

2

3

   echo "Welcome!";

?>

输出

1

Welcome!

Example

Let us see another example −

Live Demo

1

2

3

4

5

   $str1 = "Welcome!";

   $str2 = "This is our website!";

   echo $str1 . " " . $str2;

?>

输出

1

Welcome! This is our website!

Example

Let us see another example −

Live Demo

1

2

3

4

5

6

   echo "This demo

   text is on

   multiple

   lines.";

?>

输出

1

This demo text is on multiple lines.


以上就是PHP中的echo()函数的详细内容,更多请关注php中文网其它相关文章!


发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。