THE CODE

Programming

Programming is most useful when a small, clear example helps solve a real problem. This section will grow with working PHP and JavaScript examples.

PHP · TUTORIAL

How to Extract a Directory Name from a URL in PHP

Separate URL paths from query strings, identify category and article segments, and handle missing or unexpected values.

Explore
PHP · TUTORIAL

Build PHP Recommendations That Exclude the Current Page

Select related pages from a trusted directory, exclude the page being viewed, and handle small categories without duplicate links.

Explore
JAVASCRIPT · TUTORIAL

Replace onmouseover with JavaScript Event Listeners

Move hover behavior out of HTML, avoid child-element flicker, and support keyboard focus alongside pointer interaction.

Explore
PHP · TUTORIAL

How to Pick a Random Item from a PHP Array

Select one entry or several unique entries while handling array keys, empty lists and repeat choices.

Explore
PHP · TUTORIAL

PHP Redirects: How to Use header() Correctly

Send visitors to a new page without output errors, redirect loops or an untrusted destination.

Explore
PHP · TUTORIAL

Read a Text File Line by Line

Choose between file() and fgets(), with practical path and blank-line checks.

Explore
PHP · PROJECT

Build an Item of the Day

Match each physical line in a file to a calendar day with a defined time zone.

Explore
JAVASCRIPT · TUTORIAL

Replace Inline onclick

Use addEventListener() with accessible buttons, event options and cleanup.

Explore
PRACTICAL TOOL

URL Encoder & Decoder

See how URL components are encoded and decoded in the browser.

Explore
PRACTICAL TOOL

Meta Description Counter

Measure text length as you prepare page metadata.

Explore