首頁  >  文章  >  後端開發  >  PHP中的echo()函數

PHP中的echo()函數

PHPz
PHPz轉載
2023-08-21 09:33:171238瀏覽

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.com。如有侵權,請聯絡admin@php.cn刪除