Echo Function in PHP With Example

phpYour PHP code always starts with <?php and ends with ?> tags.  This basically tells your server that any code between these 2 angular brackets should be treated as PHP code.  A user can easily view the HTML source code of the web page by selecting View Source option in the browser, but if you have any embedded PHP code in the HTML file, then that will not be visible to the user in the HTML source file.

Echo function is used in PHP to output text or string.  You can use Notepad++ to create a PHP code file.  Follow this guide and select language as PHP.  Create a new file called test.php and save it to the htdocs folder of XAMPP.  Sample code is given below.

<?php

echo "Hello World!";

?>

Output:

Hello World!