Developer Encyclopedia

Learn to Code — CodePrimer

A classroom encyclopedia of HTML5, CSS3, JavaScript, PHP 8, SQL, and Laravel. Search a guide, then follow the learning path from beginner to advanced.

Popular:

Showing 291 of 291 guides

HTML5 Beginner

HTML5 Document Structure: DOCTYPE, Head, and Body

How do I write a valid HTML5 document from scratch?

Document Structure 7 min
HTML5 Beginner

HTML Charset, Viewport, and SEO Meta Tags

Which meta tags belong in the head of every HTML page?

Document Structure 7 min
HTML5 Beginner

HTML Headings and a Logical Document Outline

How should h1 through h6 be used so the outline stays logical?

Semantic Structure 7 min
HTML5 Beginner

HTML Paragraphs, Line Breaks, and Readable Text

When should I use a paragraph instead of a br line break?

Semantic Structure 6 min
HTML5 Beginner

HTML5 Semantic Landmarks: header, nav, main, and footer

How do I structure header, nav, main, article, section, aside, and footer?

Semantic Structure 8 min
HTML5 Intermediate

ARIA Basics: Roles, Labels, and When Not to Use Them

When should I add ARIA, and when is native HTML enough?

Semantic Structure 9 min
HTML5 Beginner

HTML Links: href, Absolute and Relative URLs, and rel

How do I write accessible links with safe href and rel values?

Semantic Structure 7 min
HTML5 Beginner

HTML Lists: ul, ol, dl, and Nested Navigation

How do I mark up unordered, ordered, and description lists?

Semantic Structure 7 min
HTML5 Beginner

HTML Images and alt Text for Accessibility and SEO

How do I write alt text that helps screen readers and image search?

Media & Performance 7 min
HTML5 Intermediate

Responsive Images with picture, srcset, and lazy Loading

How do I serve sharp images without wasting mobile bandwidth?

Media & Performance 9 min
HTML5 Intermediate

HTML Script Loading with defer, async, and type=module

How do I load JavaScript without blocking HTML parsing?

Media & Performance 8 min
HTML5 Beginner

Accessible HTML Forms, Input Types, and Native Validation

How do I build a form with labels, input types, and native validation?

Accessible Forms 8 min
HTML5 Beginner

HTML Button Types: submit, button, and reset

Why does a button submit the form when I only wanted a click?

Accessible Forms 6 min
HTML5 Intermediate

HTML Form Methods: GET versus POST

When should a form use GET instead of POST?

Accessible Forms 9 min
HTML5 Intermediate

Accessible HTML Tables with thead, tbody, and scope

How do I associate table headers with their cells?

Semantic Structure 8 min
HTML5 Intermediate

HTML data-* Attributes and the dataset API

How do I store small configuration values on an element?

Semantic Structure 7 min
HTML5 Beginner

HTML Disclosure Widgets with details and summary

How do I build a native accordion without JavaScript?

Semantic Structure 6 min
HTML5 Intermediate

Accessible Modals with the HTML dialog Element

How do I open an accessible modal with the dialog element?

Semantic Structure 8 min
HTML5 Beginner

HTML figure and figcaption for Captioned Media

How do I attach a caption to an image or a code sample?

Semantic Structure 6 min
HTML5 Beginner

HTML time Element for Dates

How do I mark a date so machines and people can both read it?

Semantic Structure 6 min
HTML5 Beginner

Fieldset and Legend for Form Groups

How do I label a group of related radio buttons?

Accessible Forms 7 min
HTML5 Intermediate

Sandboxed iframes

How do I embed a page without giving it your site privileges?

Media & Performance 8 min
HTML5 Intermediate

Open Graph Meta Tags

Which meta tags control a link preview title and image?

Document Structure 7 min
HTML5 Intermediate

The HTML template Element

How do I store inert markup to clone with JavaScript?

Semantic Structure 8 min
HTML5 Beginner

progress and meter Elements

How do I show a completion amount in HTML?

Semantic Structure 7 min
HTML5 Intermediate

Autocomplete Tokens on Inputs

How do I help browsers fill a checkout form correctly?

Accessible Forms 8 min
HTML5 Beginner

The HTML mark Element for Search Highlights

How do I mark words that matched a search?

Semantic Structure 6 min
HTML5 Beginner

HTML datalist for Suggested Input Values

How do I suggest track names without a closed dropdown?

Accessible Forms 6 min
HTML5 Intermediate

The HTML Popover API

How do I open a small note without a dialog script?

Semantic Structure 6 min
HTML5 Beginner

The HTML search Landmark

How do I mark the site search form as a landmark?

Semantic Structure 6 min
HTML5 Beginner

The HTML download Attribute

How do I offer a file save instead of navigation?

Semantic Structure 6 min
HTML5 Intermediate

inputmode for the Right Mobile Keyboard

How do I open a numeric keyboard without type=number?

Accessible Forms 6 min
HTML5 Beginner

The spellcheck Attribute

How do I turn spell checking off for code and on for prose?

Accessible Forms 6 min
HTML5 Intermediate

The HTML output Element

How do I show a calculated result inside a form?

Accessible Forms 6 min
HTML5 Intermediate

Hidden Fields and What Not to Trust

What is a hidden input for, and what must the server ignore?

Accessible Forms 6 min
HTML5 Beginner

The wbr Element for Optional Breaks

How do I let a long path wrap without adding spaces?

Semantic Structure 6 min
HTML5 Beginner

Link an external CSS file

How do I attach a stylesheet?

Basics 1 min
HTML5 Beginner

div vs span

When do I use div or span?

Basics 1 min
HTML5 Beginner

Radio button group

How do I let users pick only one option?

Forms 1 min
HTML5 Beginner

Checkboxes as PHP arrays

How do I submit multiple checkboxes to PHP?

Forms 1 min
HTML5 Beginner

Select dropdown

How do I make a dropdown menu?

Forms 1 min
HTML5 Beginner

Textarea multi-line input

How do I collect long comments?

Forms 1 min
HTML5 Beginner

Date, hidden, and file inputs

What special input types should I know?

Forms 1 min
HTML5 Beginner

Audio and video embeds

How do I embed media without Flash?

Media 1 min
HTML5 Beginner

Internal CSS with style tag

How do I put CSS inside the HTML file?

Basics 1 min
HTML5 Beginner

Semantic navigation bar

How do I mark up a site nav?

Layout 1 min
HTML5 Beginner

Explicit label for= binding

How do I connect a label to an input?

Forms 1 min
HTML5 Beginner

Figure with caption

How do I caption an image semantically?

Media 1 min
HTML5 Intermediate

Embed with iframe

How do I embed another page or map?

Components 1 min
CSS3 Beginner

Three Ways to Apply CSS: Inline, Internal, and External

How do I attach CSS to an HTML page?

Modern Layout 7 min
CSS3 Beginner

CSS Selectors: Elements, Classes, Descendants, and Groups

Which CSS selector should I use to target an element?

Selectors 8 min
CSS3 Intermediate

CSS Specificity: Classes, IDs, and !important

Why does my CSS rule lose to another rule?

Selectors 8 min
CSS3 Beginner

The CSS Box Model and border-box Sizing

How do width, padding, border, and margin add up?

Modern Layout 7 min
CSS3 Beginner

CSS Margin, Padding, and Margin Collapse

When does vertical margin collapse, and how do I space elements?

Modern Layout 8 min
CSS3 Beginner

CSS Flexbox: Direction, Alignment, Gap, and Grow

How do I lay out a row of items with Flexbox?

Modern Layout 9 min
CSS3 Beginner

CSS Flex Wrap and Gap for Wrapping Toolbars

How do I let flex items wrap without float hacks?

Modern Layout 7 min
CSS3 Beginner

Center an Element with Flexbox

How do I center a box horizontally and vertically?

Modern Layout 6 min
CSS3 Beginner

CSS Grid Two-Column Layout with a Sidebar

How do I build a content column and a sidebar with Grid?

Modern Layout 8 min
CSS3 Intermediate

CSS Grid: minmax, auto-fit, and grid-template-areas

How do I make a responsive card grid without media queries?

Modern Layout 9 min
CSS3 Intermediate

CSS Positioning: relative, absolute, fixed, sticky, and z-index

How do relative, absolute, fixed, and sticky positioning differ?

Modern Layout 8 min
CSS3 Intermediate

Responsive CSS with Media Queries

How do I change layout at phone, tablet, and desktop widths?

Responsive Design 8 min
CSS3 Advanced

CSS Container Queries with @container

How do I style a component based on its container, not the viewport?

Responsive Design 9 min
CSS3 Intermediate

CSS Custom Properties and var()

How do I share colors and spacing with CSS variables?

Modern Layout 7 min
CSS3 Intermediate

Fluid Typography with clamp()

How do I scale font size between a phone and a desktop without a stack of media queries?

Responsive Design 8 min
CSS3 Intermediate

CSS Transitions for Hover and Focus

How do I animate a color or transform without JavaScript?

Motion 7 min
CSS3 Intermediate

CSS Keyframe Animations

How do I define a reusable @keyframes animation?

Motion 8 min
CSS3 Advanced

Modern CSS Selectors: :has(), :is(), and :where()

How do :has(), :is(), and :where() change selector lists and specificity?

Selectors 9 min
CSS3 Beginner

CSS object-fit and object-position for Replaced Media

How do I crop a photo inside a fixed box without stretching it?

Modern Layout 7 min
CSS3 Beginner

CSS aspect-ratio for Stable Media Frames

How do I reserve a 16:9 box before the image arrives?

Modern Layout 6 min
CSS3 Intermediate

CSS Logical Properties

How do I write margin and padding that follow writing direction?

Modern Layout 7 min
CSS3 Advanced

CSS Cascade Layers with @layer

How do I control stylesheet order without raising specificity?

Selectors 8 min
CSS3 Intermediate

Native CSS Nesting

How do I nest selectors in plain CSS?

Selectors 7 min
CSS3 Intermediate

:focus-visible for Keyboard Focus

How do I style keyboard focus without a ring on every mouse click?

Selectors 7 min
CSS3 Intermediate

CSS Scroll Snap

How do I make a horizontal card row snap into place?

Modern Layout 7 min
CSS3 Advanced

CSS Subgrid

How do I align nested grid items to the parent tracks?

Modern Layout 8 min
CSS3 Beginner

CSS line-clamp for Card Blurbs

How do I cut a paragraph after two lines with an ellipsis?

Modern Layout 6 min
CSS3 Intermediate

CSS text-wrap for Headings

How do I stop a heading from leaving one word on the last line?

Modern Layout 6 min
CSS3 Beginner

CSS accent-color for Form Controls

How do I tint checkboxes and range inputs to match the catalog?

Modern Layout 6 min
CSS3 Intermediate

CSS color-mix for Tinted Surfaces

How do I tint a surface with a brand color without a preprocessor?

Modern Layout 6 min
CSS3 Beginner

CSS overflow for Long Code and Menus

How do I scroll a code sample without stretching the page?

Modern Layout 6 min
CSS3 Intermediate

CSS filter for Image States

How do I grayscale an image until it is hovered?

Modern Layout 6 min
CSS3 Beginner

CSS outline and outline-offset

How do I draw a focus ring that does not shift layout?

Selectors 6 min
CSS3 Beginner

CSS user-select for Copyable and Locked Text

How do I stop a button label from being highlighted when it is double-clicked?

Modern Layout 6 min
CSS3 Intermediate

CSS writing-mode for Vertical Labels

How do I set a vertical spine label without rotating the whole card?

Modern Layout 6 min
CSS3 Intermediate

CSS scrollbar-gutter

How do I stop a list from shifting when a scrollbar appears?

Modern Layout 6 min
CSS3 Beginner

CSS list-style and Counters

How do I number lesson steps without typing the numbers?

Modern Layout 6 min
CSS3 Beginner

CSS cursor for Controls

How do I show a pointer on a clickable card but not on plain text?

Modern Layout 6 min
CSS3 Intermediate

CSS appearance for Native Controls

How do I restyle a select without losing the control?

Modern Layout 6 min
CSS3 Intermediate

CSS hyphens for Narrow Columns

How do I break long words in a narrow lesson column?

Modern Layout 6 min
CSS3 Advanced

CSS isolation for Stacking Contexts

How do I stop a card shadow from mixing with a popup z-index?

Modern Layout 6 min
CSS3 Beginner

display block inline flex

How does display change layout?

Layout 1 min
CSS3 Beginner

Hover and focus-visible

How do I style hover and keyboard focus?

Selectors 1 min
CSS3 Beginner

Truncate long text with ellipsis

How do I cut overflow text with …?

Components 1 min
CSS3 Beginner

Simple CSS reset start

How do I normalize browser defaults a bit?

Basics 1 min
CSS3 Beginner

Space-between header layout

How do I put logo left and links right?

Layout 1 min
JavaScript Beginner

JavaScript const, let, Scope, and Hoisting

How do const and let differ from var?

Language Basics 7 min
JavaScript Intermediate

Destructuring, Spread, and Rest in JavaScript

How do I unpack objects and arrays and copy them without mutation?

Language Basics 8 min
JavaScript Intermediate

JavaScript Array Methods: map, filter, reduce, find, some, every

How do I transform and test arrays without a manual loop?

Language Basics 8 min
JavaScript Beginner

document.getElementById and Null Checks

How do I select one element by id and handle a missing node?

DOM & Async 6 min
JavaScript Beginner

querySelector for CSS-Style DOM Lookups

How do I select one element with a CSS selector?

DOM & Async 6 min
JavaScript Beginner

querySelectorAll and Iterating a NodeList

How do I select every matching element and loop them?

DOM & Async 7 min
JavaScript Intermediate

textContent versus innerHTML and XSS

When is innerHTML dangerous, and what should I use instead?

DOM & Async 8 min
JavaScript Beginner

classList add, remove, toggle, and contains

How do I change classes without rewriting the class attribute?

DOM & Async 6 min
JavaScript Intermediate

createElement, textContent, and append

How do I build DOM nodes without HTML strings?

DOM & Async 7 min
JavaScript Intermediate

DocumentFragment for Batch DOM Updates

How do I insert many nodes without reflowing on every append?

DOM & Async 8 min
JavaScript Beginner

A Click Handler that Updates the Page

How do I run JavaScript when a button is clicked?

DOM & Async 6 min
JavaScript Intermediate

Event Delegation with addEventListener

How do I handle clicks on many rows with one listener?

DOM & Async 8 min
JavaScript Intermediate

FormData, submit Events, and Client-Side Checks

How do I read a form with FormData and stop a bad submit?

DOM & Async 8 min
JavaScript Intermediate

Promises, async/await, and try/catch

How do I wait for an asynchronous result without callback pyramids?

DOM & Async 8 min
JavaScript Intermediate

fetch JSON: GET, POST, Headers, and Errors

How do I GET and POST JSON with fetch and handle HTTP errors?

Browser APIs 9 min
JavaScript Intermediate

localStorage and sessionStorage with JSON

How do I save a small object in the browser and read it back?

Browser APIs 8 min
JavaScript Advanced

Debounce and Throttle Event Handlers

How do I stop a search input or scroll handler from running too often?

Browser APIs 9 min
JavaScript Intermediate

ES Modules: import, export, and type=module

How do I split browser JavaScript into modules?

Modules 8 min
JavaScript Intermediate

Optional Chaining and Nullish Coalescing

How do I read a nested property when a middle object might be missing?

Language Basics 7 min
JavaScript Intermediate

URLSearchParams for Query Strings

How do I read and build a query string in the browser?

Browser APIs 7 min
JavaScript Intermediate

IntersectionObserver for Lazy Sections

How do I run code when an element scrolls into view?

Browser APIs 7 min
JavaScript Advanced

AbortController for fetch

How do I cancel a fetch when the user types again?

DOM & Async 8 min
JavaScript Intermediate

CustomEvent for Component Messages

How do I dispatch a named event from a widget?

DOM & Async 7 min
JavaScript Intermediate

The Clipboard API

How do I copy text with navigator.clipboard?

Browser APIs 7 min
JavaScript Intermediate

Intl for Numbers and Dates

How do I format a price and a date for a locale?

Language Basics 7 min
JavaScript Intermediate

history.pushState for Filters

How do I update the query string without reloading?

Browser APIs 7 min
JavaScript Intermediate

JavaScript Map and Set

When should I use Map or Set instead of a plain object?

Language Basics 6 min
JavaScript Intermediate

structuredClone for a Real Copy

How do I copy a lesson object without sharing nested arrays?

Language Basics 6 min
JavaScript Intermediate

ResizeObserver for Responsive Components

How do I react when a card changes width, not the window?

Browser APIs 6 min
JavaScript Intermediate

The Page Visibility API

How do I pause work when the student switches tabs?

Browser APIs 6 min
JavaScript Beginner

crypto.randomUUID for Client Ids

How do I create an id in the browser without a library?

Browser APIs 6 min
JavaScript Intermediate

TextEncoder and TextDecoder

How do I turn a string into UTF-8 bytes in the browser?

Browser APIs 6 min
JavaScript Intermediate

Error cause in JavaScript

How do I wrap a failed fetch without losing the original error?

Language Basics 6 min
JavaScript Intermediate

Array at, findLast, and toSorted

How do I read the last item and sort a copy of an array?

Language Basics 6 min
JavaScript Beginner

Template Literals

How do I build a sentence from a title and a seat count?

Language Basics 6 min
JavaScript Intermediate

requestAnimationFrame

How do I animate a progress bar without setInterval?

Browser APIs 6 min
JavaScript Beginner

Object.hasOwn

How do I check that a lesson object has its own seats field?

Language Basics 6 min
JavaScript Intermediate

The URL Class

How do I build a lesson URL without string concatenation?

Browser APIs 6 min
JavaScript Beginner

Arrow function event listener

Can I use an arrow function for events?

Dom 1 min
JavaScript Beginner

Live input event

How do I react as the user types?

Dom 1 min
JavaScript Beginner

change event on select

How do I detect dropdown changes?

Dom 1 min
JavaScript Beginner

setAttribute and style

How do I change attributes and CSS from JS?

Dom 1 min
JavaScript Beginner

Remove a DOM node

How do I delete an element?

Dom 1 min
JavaScript Beginner

Read input/select/textarea values

How do I read form field values in JS?

Dom 1 min
JavaScript Beginner

Read data-* with dataset

How do I read data-price in JavaScript?

Dom 1 min
JavaScript Beginner

mouseover tooltip style

How do I run code on hover?

Dom 1 min
JavaScript Beginner

Keyboard keydown shortcut

How do I listen for a key press?

Dom 1 min
JavaScript Beginner

JavaScript ternary operator

How do I write a one-line if/else?

Basics 1 min
JavaScript Beginner

Classic for loop

How do I loop a fixed number of times?

Basics 1 min
JavaScript Beginner

for...of over an array

How do I loop array values cleanly?

Basics 1 min
JavaScript Beginner

JavaScript object basics

How do I store keyed data in JS?

Basics 1 min
JavaScript Beginner

Wait for DOMContentLoaded

Why is getElementById null?

Dom 1 min
JavaScript Beginner

Block empty form fields in JS

How do I stop submit when a field is blank?

Forms 1 min
PHP 8 Beginner

Embedding PHP in HTML with Standard Tags

How do I open and close PHP so HTML stays valid?

Language Basics 7 min
PHP 8 Beginner

PHP Comments: Line, Block, and Docblocks

How do I comment PHP without commenting out the wrong lines?

Language Basics 7 min
PHP 8 Beginner

PHP Variable Names, Assignment, and Scope Rules

What are the rules for PHP variable names, values, and scope?

Language Basics 8 min
PHP 8 Beginner

PHP Types: Strings, Ints, Floats, Bools, Null, and Arrays

What are the core PHP types and how do I inspect them?

Language Basics 8 min
PHP 8 Intermediate

declare(strict_types=1) and Type Juggling

How do I stop PHP from silently coercing function arguments?

Language Basics 9 min
PHP 8 Beginner

PHP Strings: Concatenation, Interpolation, and Multibyte Length

How do I build and measure strings safely in PHP 8?

Language Basics 8 min
PHP 8 Intermediate

DateTimeImmutable for Time Zones and Formatting

How do I handle dates in PHP without mutating a shared clock?

Language Basics 8 min
PHP 8 Beginner

PHP Functions, Parameters, Return Types, and Defaults

How do I write a PHP function with a return type?

Language Basics 8 min
PHP 8 Intermediate

PHP Closures, Arrow Functions, and use()

How do I pass a small function to array_map or array_filter?

Language Basics 9 min
PHP 8 Beginner

PHP Associative Arrays and Nested Records

How do I store a student record in an associative array?

Language Basics 7 min
PHP 8 Intermediate

array_map, array_filter, and array_column

How do I reshape a list of rows without a manual index loop?

Language Basics 8 min
PHP 8 Intermediate

PHP Classes, Constructors, and Property Promotion

How do I model a Student with a promoted constructor?

OOP 9 min
PHP 8 Advanced

PHP Inheritance, Interfaces, and Contracts

When should I use an interface instead of extending a base class?

OOP 10 min
PHP 8 Intermediate

$_POST, Output Escaping, and XSS Prevention

How do I read a POST form and escape it before HTML?

HTTP & Files 9 min
PHP 8 Intermediate

password_hash and password_verify

How do I store a password so a database leak is not the password?

PDO & Security 8 min
PHP 8 Intermediate

json_encode, json_decode, and JSON_THROW_ON_ERROR

How do I return and parse JSON in PHP without silent failures?

HTTP & Files 9 min
PHP 8 Intermediate

PHP PDO Error Mode: Exceptions Instead of Silent Failures

How should PDO report database errors in PHP 8?

PDO & Security 9 min
PHP 8 Intermediate

PHP PDO SELECT with a Prepared Statement

How do I SELECT a row by id without concatenating SQL?

PDO & Security 8 min
PHP 8 Intermediate

PHP PDO INSERT with Prepared Statements

How do I insert a row with PHP PDO without SQL injection?

PDO & Security 9 min
PHP 8 Intermediate

PHP PDO UPDATE with a WHERE Clause

How do I update one row without changing the whole table?

PDO & Security 8 min
PHP 8 Intermediate

PHP PDO DELETE with a WHERE Clause

How do I delete one row safely with PDO?

PDO & Security 8 min
PHP 8 Advanced

PDO Transactions: beginTransaction, commit, and rollBack

How do I insert a student and an enrollment so both succeed or neither does?

PDO & Security 10 min
PHP 8 Advanced

Composer and PSR-4 Autoloading

How do I autoload PHP classes with Composer instead of a pile of require calls?

OOP 9 min
PHP 8 Intermediate

PHP 8.1 Enums

How do I represent a fixed set of tracks with an enum?

OOP 7 min
PHP 8 Intermediate

PHP match Expressions

How do I map a value with match instead of switch?

Language Basics 7 min
PHP 8 Intermediate

The PHP Nullsafe Operator

How do I call a method when the object might be null?

Language Basics 7 min
PHP 8 Intermediate

PHP Exceptions and finally

How do I throw and catch a domain exception?

Language Basics 8 min
PHP 8 Intermediate

PHP Sessions for a Signed-In User

How do I store a user id in $_SESSION safely?

HTTP & Files 8 min
PHP 8 Intermediate

filter_var for Email and Integers

How do I validate an email and an integer with filter_var?

HTTP & Files 7 min
PHP 8 Intermediate

preg_match for a Slug

How do I test that a slug contains only lowercase letters and hyphens?

Language Basics 7 min
PHP 8 Intermediate

PHP Named Arguments

How do I call a function with named arguments so defaults stay clear?

Language Basics 7 min
PHP 8 Intermediate

PHP Union Types

How do I accept an int or a numeric string without turning types off?

Language Basics 6 min
PHP 8 Beginner

PHP str_contains, str_starts_with, and str_ends_with

How do I test a string without strpos tricks?

Language Basics 6 min
PHP 8 Intermediate

PHP Readonly Properties

How do I stop a lesson id from being changed after construction?

OOP 6 min
PHP 8 Intermediate

PHP json_validate

How do I check a JSON string without decoding it into an array?

HTTP & Files 6 min
PHP 8 Intermediate

password_needs_rehash

How do I upgrade a stored password hash when the algorithm changes?

PDO & Security 6 min
PHP 8 Intermediate

PHP Headers and Output

How do I send a status and a redirect before any HTML?

HTTP & Files 6 min
PHP 8 Intermediate

PHP Randomizer for Unbiased Picks

How do I pick a lesson at random without a biased modulo?

Language Basics 6 min
PHP 8 Beginner

PHP Array Destructuring

How do I unpack the first two lessons from a list?

Language Basics 6 min
PHP 8 Advanced

PHP Attributes

How do I attach metadata to a class without a comment parser?

OOP 6 min
PHP 8 Intermediate

PHP First-class Callables

How do I pass a function to array_map without a string name?

Language Basics 6 min
PHP 8 Intermediate

mb_substr for Multibyte Titles

How do I shorten a title without splitting a character?

Language Basics 6 min
PHP 8 Beginner

number_format and Intl for Prices

How do I print a seat price with grouping and two decimals?

Language Basics 6 min
PHP 8 Beginner

echo vs print

Should I use echo or print?

Basics 1 min
PHP 8 Beginner

Debug with var_dump

How do I inspect a variable’s type?

Debugging 1 min
PHP 8 Beginner

PHP math helpers

How do I do min/max/round/random in PHP?

Basics 1 min
PHP 8 Beginner

PHP type casting

How do I cast a value to another type?

Basics 1 min
PHP 8 Beginner

PHP arithmetic operators

What are PHP math operators?

Basics 1 min
PHP 8 Beginner

PHP comparison operators

What is == vs === in PHP?

Basics 1 min
PHP 8 Beginner

PHP logical operators

How do I combine conditions?

Basics 1 min
PHP 8 Beginner

Combined assignment operators

What does += mean in PHP?

Basics 1 min
PHP 8 Beginner

if / elseif / else

How do I branch logic in PHP?

Basics 1 min
PHP 8 Beginner

Ternary and ??

How do I assign with a short conditional?

Basics 1 min
PHP 8 Beginner

switch statement

How do I handle many discrete cases?

Basics 1 min
PHP 8 Beginner

while loop

How do I loop while a condition is true?

Basics 1 min
PHP 8 Beginner

do...while loop

How do I run a loop at least once?

Basics 1 min
PHP 8 Beginner

for loop

How do I loop with a counter?

Basics 1 min
PHP 8 Beginner

foreach over arrays

How do I loop an array in PHP?

Basics 1 min
PHP 8 Beginner

Default function arguments

How do I make a parameter optional?

Basics 1 min
PHP 8 Beginner

Indexed arrays

How do I store a list in PHP?

Basics 1 min
PHP 8 Beginner

Read $_GET values

How do I read query string data?

Forms 1 min
PHP 8 Beginner

Read checkbox array in PHP

How do I read skills[] from a form?

Forms 1 min
PHP 8 Beginner

Destroy a PHP session

How do I log a user out?

Auth 1 min
PHP 8 Beginner

require db.php connection

How do I reuse one DB connection file?

Database 1 min
PHP 8 Beginner

Redirect with header Location

How do I send the browser to another page?

Basics 1 min
PHP 8 Beginner

Detect GET vs POST in PHP

How do I know which HTTP method was used?

Forms 1 min
PHP 8 Beginner

Reuse header with include

How do I share a header across pages?

Basics 1 min
PHP 8 Intermediate

Local vs global scope

Why can’t my function see an outside variable?

Basics 1 min
PHP 8 Intermediate

Static variable in a function

How do I keep a value between function calls?

Basics 1 min
PHP 8 Intermediate

Multidimensional arrays

How do I store rows of data?

Basics 1 min
PHP 8 Intermediate

Sanitize and validate input

How do I protect against XSS and bad emails?

Security 1 min
PHP 8 Intermediate

PDO connection for Laragon MySQL

How do I connect PHP to Laragon MySQL?

Database 1 min
PHP 8 Intermediate

PDO fetch all rows

How do I list records from MySQL?

Database 1 min
SQL / MySQL Beginner

CREATE DATABASE and Character Set utf8mb4

How do I create a MySQL database that stores Unicode correctly?

Relational Design 7 min
SQL / MySQL Beginner

CREATE TABLE with Keys, NOT NULL, UNIQUE, and Defaults

How do I create a table with the right data types and constraints?

Relational Design 8 min
SQL / MySQL Intermediate

ALTER TABLE to Add, Modify, and Index a Column

How do I add a column to a table that already has rows?

Relational Design 7 min
SQL / MySQL Intermediate

INSERT and UPDATE Rows with an Explicit WHERE

How do I insert a user and update that same row safely?

Queries 7 min
SQL / MySQL Intermediate

DELETE a Single Row with WHERE

How do I delete one row without emptying the table?

Queries 6 min
SQL / MySQL Beginner

SELECT, WHERE, and Comparison Predicates

How do I read specific rows from a MySQL table?

Queries 7 min
SQL / MySQL Intermediate

ORDER BY with LIMIT and OFFSET Pagination

How do I page through sorted SQL results?

Queries 8 min
SQL / MySQL Intermediate

COUNT, SUM, AVG, GROUP BY, and HAVING

How do I total and filter groups in SQL?

Queries 8 min
SQL / MySQL Intermediate

INNER JOIN Across Users, Courses, and Enrollments

How do I combine matching rows from related tables?

Queries 8 min
SQL / MySQL Intermediate

LEFT JOIN to Keep Rows with No Match

How do I list every user even when they have no enrollment?

Queries 7 min
SQL / MySQL Advanced

Indexes, Composite Indexes, and EXPLAIN

How do I index a WHERE/ORDER BY so MySQL does not scan the whole table?

Integrity & Performance 9 min
SQL / MySQL Intermediate

Foreign Keys, ON DELETE CASCADE, and ON DELETE SET NULL

How do I stop orphan enrollment rows?

Integrity & Performance 8 min
SQL / MySQL Advanced

Subqueries in WHERE and in the SELECT List

How do I filter rows using a nested SELECT?

Queries 9 min
SQL / MySQL Advanced

Common Table Expressions with WITH

How do I name a subquery so a report is readable?

Queries 8 min
SQL / MySQL Advanced

Database Normalization: 1NF, 2NF, and 3NF

How do I split repeating course lists out of a user row?

Relational Design 9 min
SQL / MySQL Advanced

SQL Transactions: START TRANSACTION, COMMIT, ROLLBACK

How do I make two writes succeed or fail together?

Integrity & Performance 8 min
SQL / MySQL Intermediate

CASE Expressions in SELECT

How do I turn a status code into a label in SQL?

Queries 8 min
SQL / MySQL Intermediate

UNION of Two Result Sets

How do I stack two SELECT results in one list?

Queries 8 min
SQL / MySQL Intermediate

CREATE VIEW for a Roster

How do I save a SELECT as a view?

Relational Design 8 min
SQL / MySQL Advanced

ROW_NUMBER and SUM Over a Window

How do I rank rows without collapsing them with GROUP BY?

Queries 9 min
SQL / MySQL Intermediate

INSERT ... ON DUPLICATE KEY UPDATE

How do I insert a row or update it when the unique key exists?

Queries 8 min
SQL / MySQL Intermediate

CHECK Constraints

How do I reject a seat count outside 1 to 40 in the table itself?

Integrity & Performance 7 min
SQL / MySQL Beginner

MySQL Date Functions

How do I filter rows from the last seven days?

Queries 7 min
SQL / MySQL Intermediate

SQL EXISTS for a Membership Test

How do I find lessons that have at least one confirmed seat?

Queries 6 min
SQL / MySQL Beginner

COALESCE and NULLIF

How do I show a fallback when a column is null?

Queries 6 min
SQL / MySQL Intermediate

SQL CAST and CONVERT

How do I compare a numeric string column as a number?

Queries 6 min
SQL / MySQL Beginner

SELECT DISTINCT

How do I list each track once?

Queries 6 min
SQL / MySQL Advanced

TRUNCATE versus DELETE

When should I empty a table with TRUNCATE instead of DELETE?

Queries 6 min
SQL / MySQL Beginner

SQL BETWEEN and IN

How do I filter lessons by a seat range or a list of tracks?

Queries 6 min
SQL / MySQL Advanced

MySQL JSON Extract

How do I read a field inside a JSON column?

Queries 6 min
SQL / MySQL Advanced

SQL INTERSECT

How do I find users who both teach and enroll?

Queries 6 min
SQL / MySQL Intermediate

SQL LIKE and Escaped Wildcards

How do I search lesson titles without treating a percent sign as a wildcard?

Queries 6 min
SQL / MySQL Intermediate

CHAR_LENGTH and LENGTH

How do I measure a title in characters instead of bytes?

Queries 6 min
SQL / MySQL Beginner

LIKE search pattern

How do I search text with a keyword?

Database 1 min
SQL / MySQL Beginner

WHERE with AND / OR

How do I combine filters in SQL?

Database 1 min
SQL / MySQL Intermediate

COUNT with GROUP BY

How do I count rows per category?

Database 1 min
SQL / MySQL Advanced

Basic transaction

How do I commit or roll back multiple writes?

Database 1 min
Laravel Beginner

Laravel Routes: URLs, Names, Parameters, and Groups

How do I declare web and API routes in Laravel?

Eloquent & Routing 8 min
Laravel Intermediate

Laravel Route Model Binding

How does Laravel turn a URL id into an Eloquent model?

Eloquent & Routing 8 min
Laravel Beginner

Laravel Controllers and Single Action Controllers

How do I move route logic into a controller?

Eloquent & Routing 8 min
Laravel Beginner

Blade Layouts, Loops, CSRF, and Components

How do I render a layout and a safe form in Blade?

Blade & HTTP 8 min
Laravel Intermediate

Form Request Validation in Laravel

How do I validate a form and keep the controller thin?

Blade & HTTP 8 min
Laravel Intermediate

Eloquent CRUD: Create, Read, Update, and Delete

How do I create, find, update, and delete a Lesson with Eloquent?

Eloquent & Routing 9 min
Laravel Intermediate

Eloquent Relationships: hasMany and belongsTo

How do I relate lessons, enrollments, and users?

Eloquent & Routing 9 min
Laravel Advanced

Laravel Eloquent Eager Loading (with) to Prevent N+1 Queries

How do I prevent N+1 database queries in Laravel Eloquent?

Eloquent & Routing 9 min
Laravel Intermediate

Laravel Migrations and the Schema Builder

How do I version a lessons table with a Laravel migration?

Eloquent & Routing 8 min
Laravel Intermediate

Laravel Seeders and Model Factories

How do I generate realistic lesson rows for local development?

Eloquent & Routing 8 min
Laravel Intermediate

Auth Middleware and Guest Routes in Laravel

How do I restrict a route to signed-in users?

Auth & Jobs 8 min
Laravel Advanced

Laravel Gates and Policies

How do I authorize an update so users only edit their own lesson?

Auth & Jobs 9 min
Laravel Intermediate

Laravel File Storage on the Public Disk

How do I validate an upload and store it on the public disk?

Blade & HTTP 8 min
Laravel Intermediate

Laravel Pagination with the Query String

How do I paginate lessons and keep the search query?

Blade & HTTP 7 min
Laravel Advanced

Laravel API Resources

How do I shape JSON for a lesson and its enrollments?

Blade & HTTP 8 min
Laravel Advanced

Query Scopes and Attribute::make

How do I reuse a published() scope and format a title?

Eloquent & Routing 8 min
Laravel Advanced

Laravel Queues and Jobs

How do I queue a slow enrollment email?

Auth & Jobs 8 min
Laravel Advanced

Laravel Task Scheduling

How do I run a command every morning?

Auth & Jobs 8 min
Laravel Advanced

Laravel Rate Limiting

How do I throttle a login or search endpoint?

Auth & Jobs 8 min
Laravel Intermediate

The Laravel HTTP Client

How do I call another JSON API from a Laravel action?

Blade & HTTP 6 min
Laravel Intermediate

Laravel Cache for a Catalog Count

How do I cache an expensive count without serving it forever?

Auth & Jobs 6 min
Laravel Intermediate

Laravel Soft Deletes

How do I hide a lesson without removing the row?

Eloquent & Routing 6 min
Laravel Beginner

Laravel Logging

How do I record a catalog failure without showing it to the student?

Auth & Jobs 6 min
Laravel Intermediate

Laravel Events and Listeners

How do I run follow-up work when a lesson is published without stuffing it in the controller?

Auth & Jobs 6 min
Laravel Intermediate

Laravel Attribute Casts

How do I get a Carbon date and a boolean from a lesson row?

Eloquent & Routing 6 min
Laravel Intermediate

Laravel Mail

How do I send a short enrollment note without building the message in the controller?

Auth & Jobs 6 min
Laravel Advanced

Laravel Signed URLs

How do I share a temporary lesson link that fails if someone edits the query?

Auth & Jobs 6 min
Laravel Intermediate

Laravel Collections

How do I group lessons by track after they are loaded?

Eloquent & Routing 6 min
Laravel Intermediate

A Custom Laravel Validation Rule

How do I reject a lesson slug that is not lowercase hyphenated words?

Blade & HTTP 6 min
Laravel Intermediate

A Custom Laravel Middleware Alias

How do I require an instructor role on a group of routes?

Auth & Jobs 6 min
Laravel Beginner

Laravel config and env

Where should a seat limit live so it is not hardcoded in a controller?

Auth & Jobs 6 min
Laravel Beginner

Laravel Session Flash Data

How do I show a one-time saved message after a redirect?

Blade & HTTP 6 min
Laravel Intermediate

Laravel Notifications

How do I notify a user on the database channel and by mail from one class?

Auth & Jobs 6 min

Need more coins?

You do not have enough coins for this action.

Your balance: 0 coins

Share

Reactions

Loading reactions…