• Your Cart is Empty
  • Cart
  • Log In

Echo

The term 'echo' could be associated with three different areas of the Internet Technologies sphere – computing, web application development and networking.

Echo in computing

In the context of computing, echo refers to a command used by operating systems to place a string on the computer terminal. Those systems include Microsoft Windows, DOS, OS/2, Unix and all UNIX-related operating systems. The echo command is usually used in shell scripts for showing status notes on the screen of the shell or the command line interpreter of an operating system. It is also used in batch files supported by DOS, OS/2, and Microsoft Windows for outputting status text to a file.

The ECHO command in the Windows Command Prompt

C:\> echo "My echo string here"
My echo string here
C:\> echo "My home dir is %HOMEPATH%"
My home dir is \Documents and Settings\David

The ECHO command in Unix/Linux based systems

$ echo "My echo string here"
My echo string here
$ echo "My home dir is $HOME"
My home dir is /home/david
$ echo -e "My echo \bstring \bhere"
My echostringhere
$ echo -e "My echo \nstring \nhere"
My echo
string
here

Possible effects with the -e option in Unix

\0NNN the character whose ASCII code is NNN (octal)

\\ backslash

\a alert (BEL)

\b backspace

\c suppress trailing newline

\f form feed

\n new line

\r carriage return

\t horizontal tab

\v vertical tab

Echo in application development

In the field of web application development, Echo represents an AJAX-written innovative web application framework created by NextApp on the basis of the swing object model. The Echo framework has been developed by adopting the event-driven programming approach, which has led to considerable facilitation in the web applications development process.

The first popular version of the Echo web application platform, named Echo2, was released in 2005. The platform combined all the benefits of the well-known API concept with the AJAX environment capabilities, leading to a much improved performance and user-experience enhancements typical of rich clients. The newest Echo version – Echo 3, was released in 2007, as a third generation framework, focused on implementing an XML-based state synchronization protocol between a server and a client web browser with the purpose of generating JavaScript-based rendering peers.

Echo in networking

As far as networking is concerned, the echo represents an Internet protocol defined in RFC 862. It was originally intended for helping administrators test and measure round-trip times in IP networks, but was gradually replaced by the ICMP (the Internet Control Message Protocol). Nevertheless, the echo protocol is still used by most UNIX-like operating systems. For a host to connect to a server that is supporting echo, it needs to use the TCP or UDP network protocols. All the information sent back by the server in this case is not affected by the echo server in any way.

Echo in PHP

The Echo in PHP has the same function as the echo used in the Windows command prompt or the Unix terminal - it’s used to display a line.

A simple PHP echo script:

<?php
echo "Hello World!" // Will display Hello World!
?>

The Echo in PHP can also display a variable or a text with HTML format tags.

<?php
$myString = "Hello World!";
echo $myString;
echo "<h5>Hello World!</h5>";
?>

Here is the output of the above example:

Hello World!
Hello World!

Since the output of a PHP file is seen as HTML code, HTML tags inserted into the "echo" command will be displayed accordingly.

PHP strings quoting

When using echo to output PHP strings, you will have to be very careful with the quoting. Usually, to output a string with echo, the string will have to be surrounded by double quotes. However, if there are quotes in the actual string, this can cause problems. There are two ways to output strings with quotes in them.

The first way is to use the backslash (\) escape character before the quotes. This will tell PHP that the quotes are to be used within the string and not to end it.

echo "<h5 class=\"specialH5\">I love using PHP!</h5>";

The second way is to replace the double quotes in your string with single quotes.

echo "<h5 class='specialH5'>I love using PHP!</h5>";

Echo strings and variables

When outputting a combination of strings and variables, you can simply place the variable in the string. PHP will see the sygil in front and use the variable value in the output.

<?php
$my_string = "a variable ";
echo "$my_string <br />";
echo "I will show you $my_string <br />";
?>

This will output:

a variable
I will show you a variable

Echo HTML code in PHP

In PHP, you can also use the echo command to output larger portions of HTML code in the PHP output

<?php
echo "<html>";
echo "<head></head>";
echo "<body class=\"page_bg\">";
echo "Hello, today is ";
echo date('l, F jS, Y');
//other php code here
echo "</body>";
echo "</html>";
?>

This usage, however, is not recommended, since it can affect the HTML coloring in most PHP/HTML editors, making your code much harder for further modifications.

Your site with NTC Hosting

At NTC Hosting you can find powerful and well-priced web hosting plans, which can satisfy all your needs. With the special PHP optimized hosting plans, which offer full support for PHP 4and PHP 5 you can enjoy a speedy and secure hosting experience. And if you are used to code your pages in other programming languages, we have included both Perl and Python in our web hosting offers, alongside the option to choose between a MySQL and a PostgreSQL database.