Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

PHP Echo

PHP Echo for beginners and professionals with examples, php file, php session, php date, php array, php form, functions, time, xml, ajax, php mysql, regex, string, oop

<< Back to PHP

PHP Echo

PHP echo is a language construct, not a function. Therefore, you don't need to use parenthesis with it. But if you want to use more than one parameter, it is required to use parenthesis.

The syntax of PHP echo is given below:

void echo ( string $arg1 [, string $... ] )

PHP echo statement can be used to print the string, multi-line strings, escaping characters, variable, array, etc. Some important points that you must know about the echo statement are:

  • echo is a statement, which is used to display the output.
  • echo can be used with or without parentheses: echo(), and echo.
  • echo does not return any value.
  • We can pass multiple strings separated by a comma (,) in echo.
  • echo is faster than the print statement.

PHP echo: printing string

File: echo1.php

echo "Hello by PHP echo";


Hello by PHP echo

PHP echo: printing multi line string

File: echo2.php

echo "Hello by PHP echo
this is multi line
text printed by 
PHP echo statement


Hello by PHP echo this is multi line text printed by PHP echo statement

PHP echo: printing escaping characters

File: echo3.php

echo "Hello escape \"sequence\" characters";


Hello escape "sequence" characters

PHP echo: printing variable value

File: echo4.php

$msg="Hello JavaTpoint PHP";
echo "Message is: $msg";  


Message is: Hello JavaTpoint PHP

Next TopicPHP Print

Related Links:

Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf