2023-08-21

PHP中的echo()函数

PHP中的echo()函数

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

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

语法

echo(str)
登录后复制

参数

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

返回值

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

示例

以下是一个示例:−

在线演示

<?php
   echo "Welcome!";
?>
登录后复制

输出

Welcome!
登录后复制

Example

Let us see another example −

Live Demo

<?php
   $str1 = "Welcome!";
   $str2 = "This is our website!";
   echo $str1 . " " . $str2;
?>
登录后复制

输出

Welcome! This is our website!
登录后复制

Example

Let us see another example −

Live Demo

<?php
   echo "This demo
   text is on
   multiple
   lines.";
?>
登录后复制

输出

This demo text is on multiple lines.
登录后复制

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

https://www.php.cn/faq/594196.html

发表回复

Your email address will not be published. Required fields are marked *