1. I've started a massive SPAM purge, any accounts that have spammed are being removed, also for a short period new user signups are disallowed until the SPAM cleaning is finished.

What does the scope of variables means?

Discussion in 'PHP' started by shepherd, Apr 2, 2013.

  1. shepherd

    shepherd Member

    Joined:
    Feb 28, 2013
    Messages:
    95
    Likes Received:
    0
    Trophy Points:
    6
    Gender:
    Male
    Loading...
  2. davidsmith

    davidsmith Member

    Joined:
    Jun 21, 2013
    Messages:
    28
    Likes Received:
    1
    Trophy Points:
    6
    Scope refers to the visibility of variables.
  3. msankar

    msankar New Member

    Joined:
    Jun 22, 2013
    Messages:
    26
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Location:
    India
    In any language, we used variables so the visibility of the variable referred by Scope. Normally, Two kind of scope is there
    1. Global scope
    2. Local scope
    If you define any variable within an function that variable having local scope and visibility within function only.
  4. webalwaysnext

    webalwaysnext Member

    Joined:
    Feb 3, 2011
    Messages:
    160
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    http://www.paullimo.com
    Scope of a variable is the lines of code from which it can be seen and/or manipulated. Scope can be thought of as visibility, because a variable's scope is where it is visible from. A variable declared within a function has scope only within that block. It is visible within any containing blocks. However, it should be noted that if a variable's name is reused in a nested declaration, then the outer variable loses scope within that block.
  5. Maureen P. James

    Maureen P. James Member

    Joined:
    Jul 8, 2014
    Messages:
    40
    Likes Received:
    0
    Trophy Points:
    6
    Gender:
    Male
    Location:
    UK, london
    The scope of a variable means the area where you can use that particular variable, that means variable can be used only in these blocks where it is declared, variable are of two type one is local and another is global.
  6. Abhinav Kumar

    Abhinav Kumar New Member

    Joined:
    Sep 15, 2014
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Location:
    Delhi
    Hi,
    scope of variable in function may be defined as Local and Global.
    for eg:
    $name="Sita";
    function scope(){
    $name="Ram";
    echo $name;
    }
    echo $name;

    Here is the output:
    in function value of $name will show the output:Ram;
    outside the function value of $name is :Sita;
  7. Bedi

    Bedi Member

    Joined:
    Sep 16, 2014
    Messages:
    15
    Likes Received:
    32
    Trophy Points:
    13
    Gender:
    Male
    Location:
    Gurgaon
    Hi,
    scope of variable depends on the functions defined area ,
    in which we use normally:
    static,
    global,

Share This Page