Introduction to PHP
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.
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
The easiest way to get started with PHP is to just do a
Hello World example. Create a new file called
.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:
<title>Diving into PHP</title>
// Display the text 'Hello World'
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
- Managing PHP Dependencies with Composer
- Getting Started with Express
- Best Visual Studio Code Extensions for 2022
- How to deploy a PHP app using Docker
- Getting Started with Deno
- How to deploy a MySQL Server using Docker
- How to Scrape the Web using Node.js and Puppeteer
- Build a Real-Time Chat App with Node, Express, and Socket.io
- Creating a Twitter bot with Node.js
- Getting Started with Vuex: Managing State in Vue
- Setting Up a Local Web Server using Node.js