PHP中的echo()函数

PHPz
PHPz 转载
2023-08-21 09:34:01 605浏览

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中文网其它相关文章!

声明:本文转载于:tutorialspoint,如有侵犯,请联系admin@php.cn删除