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

What are the basic output methods of php

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces "what are the basic output methods of php". In daily operation, I believe many people have doubts about the basic output methods of php. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "what are the basic output methods of php?" Next, please follow the editor to study!

The two basic output methods of php are "echo" and "print". Echo is used to output one or more strings, can accept multiple parameters and no return value, syntax "echo ($str)", while print is used to output a string, which can only accept one parameter and return value, syntax "print ($str)".

Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

In PHP, there are two basic output methods: echo and print.

The difference between echo and print

Echo-outputs one or more strings, can accept multiple parameters and has no return value

Print-can output only one string, can only accept one parameter and has a return value, and always returns 1

Tip: echo is slightly faster than print because it does not return any values.

PHP echo statement

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

two。 Display strings, the following example shows how to use the echo command to display different strings (and note that strings can contain HTML tags)

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

Development

Wechat

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

12
Report