Created
April 9, 2020 21:17
-
-
Save farshid1/f818608a714b924e64a1c84b3a239bd8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$events = file_get_contents( 'https://someapi.com/events' ); | |
$types = array(); | |
foreach ( $events as $event ) { | |
$types[] = $event->type; | |
} | |
$score = 0; | |
foreach ( $types as $type ) { | |
switch ( $type ) { | |
case 'type1': | |
$score += 2; | |
break; | |
case 'type2': | |
$score += 5; | |
break; | |
case 'type3': | |
$score += 10; | |
break; | |
default: | |
$score += 1; | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment