PHP is the most popular and widely-used server-side scripting language and powers million of websites on the internet. The chances are really high that many of your favorite websites use PHP. PHP is used on the server to create interactive and dynamic websites as opposed to static never-changing pages.

PHP scripts are executed on the server and returns to the user the HTML, CSS, and JavaScript that our browsers need to render a page. Because of this, the browser never actually comes in contact with or understands PHP at all. When you access a PHP-powered website, the URL you request will trigger the server to execute one or many .php files. These PHP files will ultimately generate HTML, CSS, and JavaScript, depending on the PHP code logic.

The logo for the PHP language.

In this Diving into PHP class, learn everything from the syntax for PHP, handling form data, sending emails, using cookies, making database calls, and much more. But first, make sure you meet the prerequisites for this class.


  • Intermediate knowledge of HTML. Luckily for you, we have a great class on that
  • An environment to run PHP. This can be Internet Information Services (IIS), Apache, or your own web server

With that being said, let's dive into PHP!

Selecting a Text Editor

Since PHP is ultimately just plain text, you can use any text editor you want for this class. With that being said, we suggest using Visual Studio Code. It will support the operating system you're running on, and its syntax highlighting makes writing PHP fun!

Of course, feel free to use whatever text editor you might already be using.

Visual Studio Code

Hello World

The easiest way to get started with PHP is to just do a Hello World example. Create a new file called index.php. The .php file extension lets the server know that this is a PHP file and that it should run any code that happens to be in the file. Inside the file, and enter this:

<!DOCTYPE html> <html> <head> <title>Diving into PHP</title> </head> <body> <?php // Display the text 'Hello World' echo('Hello World'); ?> </body> </html>

Save the file and access it in your browser. As you might expect, you get an otherwise blank page with the text Hello World in it. If you were able to see:

Hello World in PHP

You have everything you need to continue on with this class on PHP!

That feeling when you're ready to start learning PHP

Next Lesson »
Copyright © 2017 - 2024 All rights reserved. Made with ❤ in NY.