Learn to program in PHP, a widespread language that powers sites like Facebook.


enrolled students

4 Hours

estimated course time


required technical level

Welcome to PHP!

Introduction to PHP

This tutorial will introduce you to PHP, a server-side scripting language you can use to make dynamic websites and web applications.

Control Flow: If/Else

Conditionals and Control Flow

Control flow is how a program decides to perform one action instead of another. In PHP, we can use 'if' and 'else' to do this!

Control Flow: Switch

Control Flow: Switch

The switch statement lets you perform more complex control flow operations without using an endless chain of 'if's and 'else's.

Arrays in PHP


Arrays allow you to store lists of information in a single variable.

Loops: For and ForEach

For Loops in PHP

Arrays are awesome, but iterating over them to use each element in the array is even more awesome. We can do that with loops!

Loops: While and Do-While

While Loops in PHP

Sometimes we don't know ahead of time how many times we'll need to loop. When that's the case, we can use a different structure: a while loop.

Functions in PHP, Part I

Functions, Part I

Functions are reusable bits of code that we can use to make our programs more efficient. PHP has over 700 built-in functions—let's learn a few of them!

Functions in PHP, Part II

Functions, Part II

PHP also allows us to define our own functions. Let's learn how!

Object-Oriented Programming, Part I

Objects in PHP

Objects are combinations of data (variables) and actions (functions). In this course, we'll cover how PHP objects work and learn how to create our own!

Object-Oriented Programming, Part II

Object-Oriented PHP

PHP objects are instances of classes. In this course, we'll learn more about classes and cover advanced topics like inheritance!

Advanced Arrays and Maps

Advanced Arrays

In this course, we'll cover more advanced uses of the array data structure.

Made in NYC © 2018 Codecademy