Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // color_change to return a string based on input string in 3 specific conditions
- // ‘Fish Blanket’ to ‘Shrimp Blanket’
- // ‘Digi Plaid’ to ‘Sgt Bilko Brown’
- // ‘Rasta’ to ‘Pasta’
- // Otherwise return initial string
- function color_change( $color ) {
- switch( $color ) {
- case "Fish Blanket": // if colour is Fish Blanket then:
- return "Shrimp Blanket"; // return "Shrimp Blanket"
- case "Digi Plaid": // etc...
- return "Sgt Bilko Brown";
- case "Rasta":
- return "Pasta";
- default:
- return $color; // if no case evaluated to true, this will return the initial color
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement