PHP Echo

PHP Echo Features

  • it is a language construct so you are not required to use parentheses with it
  • Therefore always uses parenthesis if you want to use more than one parameters.
  • you know, echo not construct a function
  • PHP Echo is a language.
  • Always PHP echo statement can be used to print a string, multi-line strings, escaping characters, variable, array etc.

php echo

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

PHP Echo used to print string

File: string.php

<?php 
echo "Welcome Tutorial Scan"; 
?>

Output:

Welcome Tutorial Scan

PHP Echo printing multiline string

File: multilinestring.php

<?php 
echo "Welcome Tutorial Scan Learn here PHP and web technologies and develope the dynamic website for your business"; 
?>

Output:

Welcome Tutorial Scan Learn here PHP and web technologies and develope the dynamic website for your business

Printing escaping characters
File: echoprint.php

<?php 
echo "Welcome our \"Tutorial Scan\" Learn PHP"; 
?>

Output:

Welcome our "Tutorial Scan" Learn PHP

Printing variable value
File: variableecho.php

<?php 
$message="Welcome my Tutorial Scan and learn PHP"; 
echo "Message is: $message"; 
?>

Output:

A message is: Welcome my Tutorial Scan and learn PHP

 

Resource
PHP.Net