Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  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. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement