pastebin

Paste Search Dynamic
Recent pastes
getAnimalList
  1. <?php
  2.   // get the command
  3.   $command = $_REQUEST['command'];
  4.  
  5.   // determine which command will be run
  6.   if($command == "getAnimalList") {
  7.     // return a list of animals
  8.     echo "bird,dog,cat,cow,sheep";
  9.   } else if($command == "getAnimalSound") {
  10.     // get the animal parameter and send the right response
  11.     $animal = $_REQUEST['animal'];
  12.     if($animal == "bird") {
  13.       echo "Chirp, Chirp";
  14.     } else if($animal == "dog") {
  15.       echo "Woof, Woof";
  16.     } else if($animal == "cat") {
  17.       echo "Meow, Meow";
  18.     } else if($animal == "cow") {
  19.       echo "Moo, Moo";
  20.     } else if($animal == "sheep") {
  21.       echo "Baa, Baa";
  22.     } else {
  23.       echo "I don't know.";
  24.     }
  25.   } else {
  26.     echo "";
  27.   }
  28. ?>
Parsed in 0.064 seconds