Skip navigation.
Home

PHP Beginnings Ex. #1: Show Text in a Browser

For your first PHP exercise, create a PHP page, with the standard HTML <head>, <title> and <body> tags. This is not strictly necessary but is good practice and should the the first step for each exercise. Consider creating a template file with these tags already in place. Remember to save your file with the .php extension.

Inside the <body> tag, create a PHP section that will show the text “Hello World!” in the browser. Check your work by opening the page in a browser. If you get a blank page, check to be sure that you ended each statement with “;” and that you included the opening and closing PHP markers. When you are ready, move on to the answer script.

Please note that the yellow highlight on text to print to the browser is intended only to make it easy to see what your goal is. You don't need to highlight the text in your scripts.

Before you consider entering your answer into the comments, please read Commenting Guidelines. Comments that simply present the answer code will not be approved.