Tip: Click lines to highlight, hold ctrl/cmd to multi-select

http://codedumper.com/oveju (29-Apr @ 04:07)

mrgenixus

Syntax Highlighted Code

  1. <?php
  2.  
  3. function myTestFunction($hasDefaultParamters = true)
  4. {
  5.     echo "Start\n";
  6.     echo "num args: " . ($num = func_num_args()). "\n";
  7.    
  8.     if($num)
  9.     {
  10.         print_r(func_get_args());
  11.     }
  12.     echo "End\n";
  13. }
  14.  
  15. myTestFunction("hello","world");
  16. myTestFunction();
  17.  
  18. /*
  19. output:
  20. Start
  21. num args: 2
  22. Array
  23. (
  24.     [0] => hello
  25.     [1] => world
  26. )
  27. End
  28. Start
  29. num args: 0
  30. End
  31. */
  32.  
  33. function authenticate($u = null,$p = null,$redirect = 0){
  34.         if ($numArgs = func_num_args() > 0){
  35.            
  36.             if($numArgs >= 2) {
  37.                 if($authID = User::__validCredentials($u,$p) {
  38.            
  39.                     $this->session->set_userdata(array('user_id'=>$authID));
  40.                     return $authID;
  41.                 }
  42.                 else if ($redirect) {
  43.                    
  44.                     redirect('/login');
  45.                     die("Redirecting...");
  46.                 }
  47.             }
  48.         }
  49.        
  50.         return 0;
  51.        
  52.     }

Plain Code

<?php 

function myTestFunction($hasDefaultParamters = true)
{
    echo "Start\n";
    echo "num args: " . ($num = func_num_args()). "\n";
    
    if($num)
    {
        print_r(func_get_args());
    }
    echo "End\n";
}

myTestFunction("hello","world");
myTestFunction();

/*
output:
Start
num args: 2
Array
(
    [0] => hello
    [1] => world
)
End
Start
num args: 0
End
*/

function authenticate($u = null,$p = null,$redirect = 0){
        if ($numArgs = func_num_args() > 0){
            
            if($numArgs >= 2) {
                if($authID = User::__validCredentials($u,$p) {
            
                    $this->session->set_userdata(array('user_id'=>$authID));
                    return $authID;
                }
                else if ($redirect) {
                    
                    redirect('/login');
                    die("Redirecting...");
                }
            }
        }
        
        return 0;
        
    }

Permalink: http://codedumper.com/oveju