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

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 0.67 KB  |  hits: 6  |  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 class function naming
  2. class myclass {
  3.     public function tempclass () {
  4.         echo "default";  
  5.     }
  6.     public function tempclass ( $text ) {
  7.         echo $text;
  8.     }
  9. }
  10.        
  11. tempclass('testing'); // ( called after creating the object )
  12.        
  13. public function tempclass () {
  14.   switch ( func_num_args() ) {
  15.     case 0:
  16.       /* Do something */
  17.       break;
  18.     case 1:
  19.       /* Do something else */
  20.   }
  21. }
  22.        
  23. public function tempclass ( $text = false ) {
  24.   if ( $text ) {
  25.     /* This method was provided with text */
  26.   } else {
  27.     /* This method was not invoked with text */
  28.   }
  29. }
  30.        
  31. class myclass {
  32.     public function tempclass ($text='Default') {
  33.         echo $text;
  34.     }
  35. }