The term 'echo' could be associated with three different areas of the Internet Technologies sphere – computing, web application development and networking.
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.
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.
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.
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.
The Echo in PHP can also display a variable or a text with HTML format tags.
<?phpHere is the output of the above example:
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.
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>";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.
<?phpThis will output:
a variableIn PHP, you can also use the echo command to output larger portions of HTML code in the PHP output
<?phpThis 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.
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.