Capstone Project · 10 min read · Beginner
Capstone: Auto-Graded PHP Score Summary
Combine typed PHP 8 functions, array_filter, and associative arrays to pass all 4 automated PHP checks in your browser.
What you'll learn
- Implement a typed summarizeScores(array $scores): array function
- Compute count, passed scores (>= 80), and rounded average safely
- Pass all 4 automated PHP checks in WebAssembly
Welcome to the Modern PHP 8 Essentials capstone! Implement summarizeScores(array $scores): array so it returns an associative array with count, passed (scores >= 80), and average (rounded to 1 decimal place, or 0.0 for an empty array).
Auto-Graded PHP Capstone Challenge
Click Run & Test below to execute your PHP 8 code and verify all 4 automated checks!
PHPPHP Capstone: Score Summary Helper
PHP 8 Output (WebAssembly)
Click Run PHP to execute real PHP 8 right in your browser.
Automated PHP Checks
- Returns count === 4 for [74, 82, 96, 88]
- Filters passing scores >= 80 into [82, 96, 88]
- Computes average === 85.0
- Handles empty array [] safely with average 0.0
PHP 8 Essentials Final Check
Score: 0 / 1
1. Why did we wrap array_filter(...) in array_values(...) in our capstone?
Study Workspace
Finished this lesson?
Your progress is saved locally in your browser, no account needed.