SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. // color_change to return a string based on input string in 3 specific conditions
  4. // ‘Fish Blanket’ to ‘Shrimp Blanket’
  5. // ‘Digi Plaid’ to ‘Sgt Bilko Brown’
  6. // ‘Rasta’ to ‘Pasta’
  7. // Otherwise return initial string
  8.  
  9. function color_change( $color ) {
  10.     switch( $color ) {
  11.         case "Fish Blanket":            // if colour is Fish Blanket then:
  12.             return "Shrimp Blanket";    // return "Shrimp Blanket"
  13.         case "Digi Plaid":              // etc...
  14.             return "Sgt Bilko Brown";  
  15.         case "Rasta":
  16.             return "Pasta";
  17.         default:
  18.             return $color; // if no case evaluated to true, this will return the initial color
  19.     }
  20. }
  21.  
  22. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top