Original code:
standings = array(); foreach($players as $index => $p) { $this->standings[$p] = array ( 'index' => $index, 'games_played' => 0, 'score' => 0 ); } } public function recordResult($player, $score) { $this->standings[$player]['games_played']++; $this->standings[$player]['score'] += $score; } public function playerRank($rank) { return NULL; } } $table = new LeagueTable(array('Mike', 'Chris', 'Arnold')); $table->recordResult('Mike', 2); $table->recordResult('Mike', 3); $table->recordResult('Arnold', 5); $table->recordResult('Chris', 5); echo $table->playerRank(1);
Dashboard
Start Trial
Sign In
Home
Product
Features
Use Cases
Customers
ROI Calculator
Integrations
Assessments
Tests
Questions
Pricing
Resources
Book: Evidence-Based Hiring
Blog
Support
Contact Us
Legal
For Jobseekers
© TestDome, 2024.