Skip to content
Carlo Fontanos
Carlo Fontanos

Carlo Fontanos

Software Engineer

I build web applications and share what I learn along the way.

© 2026

PHP

37 tutorials

Step-by-step programming tutorials on PHP, JavaScript, Laravel, WordPress and more.

PHP Intermediate

preg_replace_callback: Regex Replacements With a Brain

When each match needs logic - lookups, formatting, escaping - preg_replace hits its ceiling. The callback variant runs code per match, and preg_quote keeps user input from breaking your patterns.

3 min 170
PHP Intermediate

readonly + Constructor Promotion: DTOs in Five Lines

The 40-line value object - properties, constructor assignments, getters - collapses into a declaration. Modern PHP makes immutable data carriers nearly free to write.

2 min 408
PHP Intermediate

Backed Enums Are Your Status Fields' Best Friend

Order statuses as loose strings invite typos, scattered labels and unguarded transitions. PHP 8.1 enums centralize the values, their behavior, and - with match - force you to handle every case.

2 min 557
PHP Intermediate

strlen(...) Is Valid PHP Now: First-Class Callables

PHP 8.1 turned functions into values you can pass, store and compose - ending the string-callable era of 'array_map("strtoupper", ...)' and its silent refactoring bugs.

2 min 875
PHP Intermediate

A Real Upload Progress Bar with XMLHttpRequest and PHP

fetch() still cannot report upload progress reliably - but XMLHttpRequest has done it for fifteen years. The full pattern: progress events, a PHP receiver, and the config limits that silently break big uploads.

2 min 2,906