Results 1 to 3 of 3

Thread: php

  1. #1

    php

    What all the global variables in PHP?


  2. #2
    Expert Member
    Join Date
    May 2009
    Answers
    1,374

    Re: php

    Quote Originally Posted by angadi.basavaraj View Post
    What all the global variables in PHP?

    Hi Basavaraj,

    I'll give u an example related to global variable...

    $a = 1;
    $b = 2;

    function Sum()
    {
    global $a, $b;

    $b = $a + $b;
    }

    Sum();
    echo $b;
    ?>


    The above script will output 3. By declaring $a and $b global within the function, all references to either variable will refer to the global version. There is no limit to the number of global variables that can be manipulated by a function.

    I think the example will resole your query.....

    Thanks,
    Riju.


  3. #3

    Re: php

    thanks good information.Variable is defined outside the function,these varible is known as Global Variable.


  4.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact