Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to return multiple variables using Javascript

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 286
    Comment on it

    Hello Reader's!, If you have a condition in which you need to return two or more variable from function like below:-

    functions()
    {
    //you calculation for result
     return $a, $b;
        }
    

    Now you will face the error. But you can use the array function to return as a single variable, See the example below:-

    function ()
    {
    //your calculation part goes here
    
    $result = array();
    $result = ['var a' => $a, 'var b' => $b ];
    
    //now you can easily return this $result array
    return $result;
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: