PHP interview warm-up

PHP 8 comparisons, references, array keys, enums and the array/string functions you'll be asked to use.

  1. PHP 8 String-to-Number Comparison How `==` changed in PHP 8 and why numeric strings still compare as numbers. Medium PHP
  2. foreach by Reference Leftover A dangling reference after `foreach (... as &$item)` corrupts the next loop. Medium PHP
  3. Array Key Casting Which keys PHP silently converts to integers. Hard PHP
  4. Leaderboard Sorting with usort and <=> Sort associative arrays by several keys using the spaceship operator. Easy PHP
  5. Slugify a Title (Strings & Regex) Turn a title into a URL slug with a maximum length that doesn't cut words. Easy PHP
  6. Order Status Enum with Transitions Use a PHP 8.1 backed enum with methods to enforce valid state changes. Medium PHP
  7. Revenue Report from CSV Parse a CSV export, skip bad rows and total paid revenue per region. Easy All 5 languages
  8. Two Sum Find the indices of the two numbers that add up to a target. Easy Most asked All 5 languages
  9. LRU Cache A fixed-capacity cache that evicts the least recently used key, with O(1) get and put. Medium Most asked All 5 languages

← All coding problems