PHP

A backend scripting language to create web applications

Beginner
15 hrs 31 mins
35 chapters

Overview

PHP, which stands for PHP: Hypertext Preprocessor, is a powerful scripting language conceived of helping developers easily create the backend of a web application.

It is a server-side language that powers over 75% of websites out there whose backend programming language is known, according to this report on W3Techs.

PHP is a high-level interpreted language that is much like the C programming language in terms of syntax and semantics. A person familiar with C, or any C-style language will have no problem in understanding PHP. However, even without any prior knowledge of programming, PHP is a very good choice as the very first programming language for any beginnger, although a knowledge of HTML and JavaScript really helps in the longer run.

PHP has a large scope for jobs. There are many frameworks built around PHP to ease web development such as Symfony, Laravel, CodeIgniter. This is evident of the fact that knowing PHP improves your portfolio and increases your chances of landing at a good job. Some big names out there use PHP to power their web applications. To name a few, we have Facebook, Wordpress, MediaWiki and Drupal.

The best part about PHP is that it is extremely simple to learn, yet extremely powerful and robust. We can do anything in PHP that we can do in any other sophisticated language. You name it — file handling, image processing, PDF processing, multithreading — everything can be done in PHP.

Prerequisites

  • HTML

    Routinely in this course, we'll construct HTML markup to create various kinds of applications. Prior knowledge of HTML is thus a clear-cut requirement.

  • CSS

    Although CSS isn't directly associated with PHP, we'll also routinely use it to style our HTML markup.

  • JavaScript

    Although JavaScript isn't directly associated with PHP, we'll use it sometimes to interface with the server side asynchronously.

Learning outcomes

By the end of this course, you will know:

  • How to install and set up PHP on your computer, code PHP programs in VS Code, and execute them using the PHP interpreter.
  • How to create simple CLI programs by reading from and writing to standard input and standard output, respectively.
  • How to work with common data types in PHP, including integers, floats, strings, Booleans, arrays and functions.
  • How to develop programs following the procedural paradigm.
  • How to reason about programming problems and construct efficient solutions for them.
  • How to work with some advanced features of PHP, such as references, closures, string formatting, and how to use them in solving real-world problems.

Table of contents

  1. In this unit, we'll cover all the foundational ideas of PHP including how to set up the environment to write and thereby execute PHP scripts. We'll learn about such things as variables, strings, integers, floats, data types and much more. We'll see how to write output to the terminal and retrieve input via the terminal. We'll explore functions, operations and PHP's control flow structures, in addition to the concept of variable scoping.

  2. In this unit, we explore functions, an integral part of programming. We'll start by reviewing some basics of functions in PHP and get to know of a couple of gotchas related to functions. Next, we'll dig deeper into working with functions parameters and arguments in PHP. The unit will reach its end with a thorough discussion on closures, an intriguing concept in programming, and recursions, an ingenious idea to solve a plethora of programming problems.

FAQs

Not at all! In fact, one of the reasons why newbies, done with learning frontend technologies, are introduced to PHP as a server-side technology is its simplicity.

Getting started with PHP is really easy, and you can easily get comfortable with the basics of the language in almost a week. However, if we look at it holistically, PHP is extremely huge, with a countless amount of built-in features and functions. Learning all of this can take quite some time, obviously depending on your learning speed and prior programming experience. Expect somewhere between 2 - 4 months to reach your full potential working in PHP.

Theoretically, yes. But practically speaking, as PHP is most commonly used as a server-side scripting language, powering the backend of web applications, it's desirable that you are at least comfortable with common frontend technologies such as HTML, CSS, and JavaScript, and a little bit knowledge of HTTP.

While it's true that many other technologies have sprung up over the years, competing with PHP, to aid in web development, the language still continues to host innovations and receive a huge support from its open-source community. Moreover, PHP still runs on a staggering number of servers around the globe, and if we add the power of PHP frameworks to the equation, then it's more than just clear that PHP is still a highly relevant language to learn today.

It's quite unfortunate that most, if not all, resources out there teaching PHP treat it only as a server-side technology, powered by a web server like Apache. In reality, PHP is a general-purpose scripting language that can be used to do a lot of different things, not just web development. For example, PHP is a really handy tool to build command-line programs. The aim of this course is to appreciate this aspect of PHP.

If you're having a hard time understanding a given concept in the course, feel free to reach out to me at bilal@codeguage.com, describing the issue you're facing. I'll try my level best to help you out.

The courses on Codeguage are released while they are still under construction so that learners can get early previews. As I continuously work on adding more and more content to the courses, if a given topic isn't covered today, there's a high chance that it's already under way and will show up very soon. You can follow Codeguage on Twitter to be updated with all the latest content releases.

Write to me at bilal@codeguage.com.

Let's get learning!

Start learning

Recent courses

Pre-release

Node.js

A runtime environment executing JavaScript outside the browser