Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use echo and print statements in PHP 5

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use echo and print sentences in PHP 5, which has a certain reference value. Interested friends can refer to it. I hope you can learn a lot after reading this article.

PHP 5 echo and print statements

There are two basic output modes in PHP: echo and print.

.

PHP echo and print statements

The difference between echo and print:

Echo-can output one or more strings

Print-only one string is allowed to be output, and the return value is always 1

Http://www.iis7.com/b/wzjk/

Tip: the output speed of echo is faster than that of print. Echo does not return a value, while print has a return value of 1.

.

PHP echo statement

Echo is a language structure that can be used without parentheses or with parentheses: echo or echo ().

Displays the string. Strings can contain HTML tags

Display variables in double quotation marks

.

PHP print statement

Print is also a language structure, with or without parentheses: print or print ().

Displays a string that can contain HTML tags

Display variables in double quotation marks

:

Instructions for using PHP (File Terminator) EOF (heredoc, grammatical structure)

PHP EOF (heredoc) is a way to define a string in command-line shell (such as sh, csh, ksh, bash, PowerShell, and zsh) and programming languages (such as Perl, PHP, Python, and Ruby).

Overview of usage:

1. Must be followed by a semicolon, otherwise the compilation will not pass.

2. EOF can be replaced with any other character, as long as the end identity is consistent with the start identity.

3. The closing logo must be on a separate line (that is, it must start at the beginning of the line and cannot connect any whitespace and characters before and after).

4. The initial identification can be without quotation marks or single or double quotation marks, and the effect without quotation marks is the same as that with double quotation marks, explaining embedded variables and escape symbols, while single quotation marks do not explain embedded variables and escape symbols.

5. When the content requires embedded quotation marks (single or double quotation marks), there is no need to escape the single and double quotation marks, which is equivalent to the use of Q and qq.

Note:

1. To

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report