StaffCoder
PHP

PHP Programming Exercises

PHP 8
10 modules · 49 challengesSign up
Module 1 of 10 · 5 challenges

Types and Comparisons

Learn how to declare strict scalar types on functions, compare values without loose-equality surprises, handle missing values with nullable types and the null coalescing operator, pick results with match, and combine all four in a shipping fee calculator.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

5 challenges

Typed Checkout Math

Sign up to unlock
50%1 of 2 solvedeasy
About this challenge

Add strict typing and typed signatures to checkout helpers that compute line totals, taxed totals and free-shipping eligibility.

Solved in a browser IDE and graded by tests. Sign up to solve

Optional Customer Fields

Sign up to unlock
100%1 of 1 solvedeasy
About this challenge

Write nullable and union typed customer helpers that fall back cleanly when a nickname or delivery zone is missing.

Solved in a browser IDE and graded by tests. Sign up to solve

Exact Coupon Matching

Sign up to unlock
—No data yeteasy
About this challenge

Compare coupon codes exactly and parse order quantities so look-alike numeric strings are rejected.

Solved in a browser IDE and graded by tests. Sign up to solve

Order Status Labels

Sign up to unlock
—No data yeteasy
About this challenge

Turn raw numeric status codes and parcel weights into labels with match expressions.

Solved in a browser IDE and graded by tests. Sign up to solve

Shipping Fee Calculator

STAR
Solving it completes the module
—No data yeteasy
About this challenge

Build a strictly typed shipping quote that validates raw weights, defaults missing zones and prices bands and zones with match.

Solved in a browser IDE and graded by tests. Sign up to solve

About this path

Learn modern PHP 8.4 with strict types, OOP, Composer, file handling, JSON, databases, and secure web development.

Frequently asked questions

4

What will I practice in this path?

10 modules: Types and Comparisons, Functions and Closures, Arrays, Strings and Text, Classes and Objects, Inheritance and Interfaces, Exceptions, Enums, Namespaces and Autoloading and Files and JSON.

How many PHP exercises are there, and how hard are they?

49 exercises: 20 easy and 29 medium.

What does this path run on?

Challenges run on PHP 8.

Do I need to install anything?

No. Every challenge runs in a browser-based IDE with everything already set up, and your code is graded automatically against a test suite.

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.