PHP

PHP, which is an acronym for 'PHP: Hypertext Preprocessor', is a scripting language primarily made to create robust web applications.

Difficulty

Beginner

Course Duration

15 hrs 31 mins

Chapters

35

Exercises

24

Quizzes

11

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.

Course 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.

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. Foundation

    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. Numbers

    In this unit, we'll explore the world of numbers in PHP. We'll get to know about the internal representation of integers and floats, the exponential notation and the symbol E, how to round numbers, how to obtain random integers and much more.
  3. Strings

    Strings are the cornerstone of modern-day programming. In this unit, we'll unravel all the aspects of working with strings in PHP, starting with the very basics, then moving over to concepts such as padding which is used a lot in formatting terminal output. Lastly, we'll explore string functions in PHP and then end with a final unit quiz.
  4. Control Flow

    Control-flow is used to refer to features of a language that affect the flow of control (execution) while running a program. In this unit, we'll cover the most common control-flow statements in PHP, starting with conditional statements: if, else, elseif, and switch, and then ending with iterative statements: for, while, and foreach.
  5. Arrays

    This unit is all about one of the most useful data types in all languages — arrays. After getting a quick recap of what we learnt thus far regarding arrays in this unit, we'll be kicking into high gear. In particular, we'll explore associative arrays, array operators, common and advanced array functions, multidimensional arrays, array destructuring and unpacking, and how to sort arrays.
  6. Functions

    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

  • Is PHP difficult to learn?

    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.

  • How long can it take to learn PHP?

    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.

  • Can I take this PHP course without any prior programming experience?

    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.

  • Is PHP still relevant in modern web development, considering the rise of other technologies?

    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.

  • Why does this course begin with PHP from the perspective of a command-line tool and not a server-side technology per se?

    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.

  • What if I get stuck somewhere in the course?

    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.

  • Some important topics are missing from the course. Why is that so?

    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.

  • How can I ask any general questions related to the course's content?

    Write to me at bilal@codeguage.com.

It's different the 'Codeguage way'

Fundamentals-focused

When you have a robust foundation, with the fundamentals crystal-clear, your mind will intrinsically get that ability to handle any kind and level of complexity.

Comprehensive

With a comprehensive resource that covers literally every aspect of a given topic, your time is spent practicing the learnt concepts, not resolving confusions and basic questions.

Detailed

Coding is a detailed craft. Likewise, any resource trying to teach it in any way should be detailed as well, or else people will have to acquire those integral details from different places in a fragmented and haphazard manner.

Well-structured

Structure is vital to an intuitive learning experience of a given resource. Without structure, the right concepts get introduced at the wrong times, ultimately leading to confusion and breaking the desired flow of comprehension.

Let's start the learning!