How To Use Echo To Print Data In PHP
Có thể bạn quan tâm
In PHP, echo() is used to output one or more strings in a web browser. However, echo is not a function, rather, a language construct and can, therefore, be used with or without the parenthesis.
However, if multiple parameters are to be passed, they must not be enclosed in parenthesis as that will generate an error.
Syntax
The general syntax of echo is:
<?php echo (value);?>Examples
Let’s take a look at some examples to see how echo works.
1. Printing a string
The following code prints a string on the browser:
2. Printing an integer variable
Note: In order to separate two or more parameters, a comma , or a full stop . may be used.
3. Printing value from an array
The following code will demonstrate how we can print an element from an array:
Relevant Answers
Explore Courses
Free Resources
Copyright ©2025 Educative, Inc. All rights reservedTừ khóa » E Echo Php
-
PHP Echo And Print Statements - W3Schools
-
PHP Echo() Function - W3Schools
-
Echo - Manual - PHP
-
Echo -e Content Of File Fetched Using Foreach - Stack Overflow
-
PHP Echo And Print - Pi My Life Up
-
Qual é A Diferença Entre Echo, Print E Print_r Em PHP? - Acervo Lima
-
PHP Echo And Print - GeeksforGeeks
-
Curso De PHP/Comandos/Echo - Wikilivros
-
Diferença Entre Echo E Print Em PHP - Natapa
-
Display All PHP Errors: Basic & Advanced Usage
-
WuT x 2: TCP Echo Server With PHP
-
How To Check PHP Version {2 Methods Explained} - PhoenixNAP
-
Home - Twig - The Flexible, Fast, And Secure PHP Template Engine
-
Echo Vs. Print In PHP - Difference And Comparison - Diffen