Last active
August 29, 2015 14:25
-
-
Save kevinwhoffman/45b55c621dec319d367a to your computer and use it in GitHub Desktop.
Checking price based on zip code
This file contains 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
$zip = '00001'; // $zip can be populated by form submission | |
$pricing = $array( | |
// zip => price associated with that zip | |
'00001' => 10, | |
'00002' => 15, | |
'00003' => 20 | |
); | |
// check if zip exists within array, and return the matching price | |
if ( in_array( $zip, $pricing ) ) { | |
return $pricing[$zip]; // returns 10 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment