Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 0.70 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. PHP question about functions with arguments. Help appreciated
  2. <?php
  3.  
  4. echo name_fixer("WILLIAM", "henry", "gAtEs");
  5.  
  6. function name_fixer($name1, $name2, $name3) {
  7.     $name1 = ucfirst(strtolower($name1));
  8.     $name2 = ucfirst(strtolower($name2));
  9.     $name3 = ucfirst(strtolower($name3));
  10.  
  11.     return $name1 . " " . $name2 . " " . $name3;
  12. }
  13.        
  14. myFunction ('a','b'); // call myFunction, passing 2 values
  15.  
  16. // function receives 2 values
  17. function myFunction($argument1, $argument2) { // <-- function declaration
  18.   echo $argument1 . "<br/>";
  19.   echo $argument2 . "<br/>";
  20. }
  21.        
  22. function fixName($name)
  23. {
  24.     $fixedName = ucfirst(strtolower($name));
  25.  
  26.     return $fixedName;
  27. }
  28.        
  29. fixName($name)
  30.        
  31. nameFixer($name)