Learn PHP

If you want to be a web developer, you need to learn PHP. Read these free tutorials to master this powerful and popular scripting language.

Getting started with PHP

  • How to Build a Simple REST API in PHP

    How to Build a Simple REST API in PHP

    Sajal Soni
  • How to Use Sessions and Session Variables in PHP

    How to Use Sessions and Session Variables in PHP

    Sajal Soni
  • How to Upload a File in PHP (With an Example)

    How to Upload a File in PHP (With an Example)

    Sajal Soni
  • All PHP tutorials:

    1. How to Work With Regular Expressions in PHP

      How to Work With Regular Expressions in PHP

      Tutorial Beginner

      In this article, we’ll look at the PHP functions that allow you to use regular expressions to perform search and replace operations on strings.

    2. How to Use Base64 Encoding in PHP

      How to Use Base64 Encoding in PHP

      Tutorial Beginner

      In this quick article, we’ll discuss the basics of base64 encoding in the context of PHP. Basically, we’ll see how to use PHP functions to transform data...

    3. Get the First and Last Elements of an Array in PHP

      Get the First and Last Elements of an Array in PHP

      Tutorial Beginner

      In this tutorial, you will learn about four different PHP functions to quickly get the first and last elements of an array.

    4. How to Use the array_map Function in PHP With Examples

      How to Use the array_map Function in PHP With Examples

      Tutorial Beginner

      In this quick article, we’ll discuss the array_map function in PHP. Basically, we’ll go through the syntax of the array_map function and demonstrate how to...

    5. Create a Contact Form in PHP

      Create a Contact Form in PHP

      Tutorial Beginner

      This tutorial will teach you how to create your own basic contact form in PHP. You'll also learn how to validate and sanitize user input and email the...

    6. Search and Replace Strings With Regular Expressions in PHP

      Search and Replace Strings With Regular Expressions in PHP

      Tutorial Intermediate

      In this tutorial, you'll learn how to search and replace strings with regular expressions in PHP.

    7. PHP Superglobals Explained—With Cheatsheet

      PHP Superglobals Explained—With Cheatsheet

      Tutorial Beginner

      In this post, you'll get a cheatsheet quick reference to all the PHP superglobal variables available in PHP.

    8. How to Replace Strings in PHP

      How to Replace Strings in PHP

      Tutorial Beginner

      This tutorial will teach you how to replace strings in PHP. We will cover a bunch of cases like replacing a single substring or multiple substrings. We will...

    9. How to Use cURL in PHP

      How to Use cURL in PHP

      Tutorial Beginner

      Today, we’re going to explore the cURL extension in PHP, which allows you to make HTTP requests from your code.

    10. How to Generate a PDF File in PHP

      How to Generate a PDF File in PHP

      Tutorial Beginner

      In this article, we’re going to discuss how you can generate PDF files in PHP. We'll use the TCPDF library to demonstrate how to create PDF documents.

    11. Understanding Variable Scope in PHP

      Understanding Variable Scope in PHP

      Tutorial Beginner

      In this tutorial, you will learn about variable scope in PHP. We will also cover the usage of global and static keyword.

    12. Formatting the Current Date and Time in PHP

      Formatting the Current Date and Time in PHP

      Tutorial Beginner

      This tutorial will teach you how to format the current date and time in PHP. You will also learn how to get the timestamp from a date string and how to add...