PHP lists and maps
Work with ordered lists and key-value lookups. Follow a pickup roster, change a booking, or combine stock counts from two deliveries.
Lists · build and edit
- Array append assignmentAdd the last student to the bus register
- Array element replacementCorrect the second stop on a shuttle route
- array_filterClear empty stock bins from the pick list
- array_mapClean the names on two visitor badges
- array_splice for insertionInsert two pickup stops before the depot
- array_splice for removalTake a cancelled item off a packing list
Lists · positions and ranges
- Indexed array accessRead the second name on the pickup roster
- array_reverseRead a receipt history newest first
- array_sliceSelect two orders for the packing bench
Maps · look up and assign
- Associative array assignmentUpdate the count for a shelf label
- Null coalescing assignmentKeep the first reservation for a seat
- Null coalescing lookupShow a balance for an item never received
- array_key_existsFind a parcel whose driver is still unassigned
- unset after owner comparisonRelease a locker only for its recorded owner
Maps · combine and transform
- Array assignment by valueKeep the price shown on yesterday's menu
- Nested array appendGroup two parcels on one delivery route
- array_replaceApply weekend opening hours
- ksort and foreachPrint shelf totals in aisle order
Other collection guides
- array_count_valuesBuild a frequency table from order statuses
- usort and the spaceship operatorRank scores with an explicit tie rule
- array_filter and array_valuesRetain zero readings and reset numeric keys
- PDO::prepare and executeTotal sales in a temporary database
- array_keys and countCount items at the offer price
- array_sumAdd the prices on a shopping list
- in_arrayCheck for a price in a sale list
- minFind the cheapest item in a basket