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

PHP Files and JSON

Learn how to read and write whole files, stream lines and CSV rows, encode and decode JSON with strict error handling, control how your objects serialise, and convert a product feed into a catalog file with a report of rejected rows.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

5 challenges

Packing Note Files

Sign up to unlock
—No data yetmedium
About this challenge

Packing notes are kept as one small text file per order, and the packing screen breaks on orders that never had a note, shows an old note after staff rewrote it, and cannot clear a note once the order ships.

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

Stock Sheet Exchange

Sign up to unlock
—No data yetmedium
About this challenge

The warehouse swaps stock sheets with a supplier as CSV, and names with commas, quotes or Windows paths come back split across columns or with stray characters, while the line counter loads whole multi-gigabyte sheets into memory and leaves files open.

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

Readable Catalog JSON

Sign up to unlock
—No data yetmedium
About this challenge

Translators cannot read the exported catalog because every accented letter and slash arrives as an escape sequence on one long line, and a corrupted catalog file is quietly loaded as an empty catalog instead of stopping the import.

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

Serializable Product Records

Sign up to unlock
—No data yetmedium
About this challenge

Saving products as JSON produces empty objects, and the storefront expects every product in one fixed field layout that leaves out tags a product does not have.

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

Catalog Feed Converter

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

Suppliers deliver product feeds as CSV, and the storefront needs a readable JSON catalog of the good lines plus a CSV of every rejected line with its reason, rebuilt cleanly on every run with nothing left over from the previous one.

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

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.