Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A Practical Guide to Refactoring your PHP Code: Functional methods example 3
<?php
$scores = array(
'type1' => 2,
'type2' => 5,
'type3' => 10,
);
$score = 0;
foreach ( $types as $type ) {
$score += isset( $scores[$type] ) ? $scores[$type] : 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.