Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

variable dieing?

Homerun31Homerun31 Member Posts: 99
dunno no why but ive been using this same variable for a long time and it has been working fine and then out of no where it wasnt working. any reason why that would happen?

Comments

  • JonathanJonathan Member Posts: 2,914
    : dunno no why but ive been using this same variable for a long time and it has been working fine and then out of no where it wasnt working. any reason why that would happen?
    :
    Sounds odd, can you post some example code that shows this happening? Are you sure it isn't a scoping issue?

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • ManningManning Member Posts: 1,621
    : : dunno no why but ive been using this same variable for a long time and it has been working fine and then out of no where it wasnt working. any reason why that would happen?
    : :
    : Sounds odd, can you post some example code that shows this happening? Are you sure it isn't a scoping issue?


    Just a guess, but maybe it's a global variable from a get/post/cookie/etc that worked with the old PHP versions, but his provider upgraded and now register_globals is off so the variable is now invalid.

    homerun31: If that sounds possible, try changing from this syntax: $foobar, to this: $_GET['foobar'] or $_POST['foobar'] or $_COOKIE['foobar'] or etc...


  • Homerun31Homerun31 Member Posts: 99
    whats scoping mean?



    : : : dunno no why but ive been using this same variable for a long time and it has been working fine and then out of no where it wasnt working. any reason why that would happen?
    : : :
    : : Sounds odd, can you post some example code that shows this happening? Are you sure it isn't a scoping issue?
    :
    :
    : Just a guess, but maybe it's a global variable from a get/post/cookie/etc that worked with the old PHP versions, but his provider upgraded and now register_globals is off so the variable is now invalid.
    :
    : homerun31: If that sounds possible, try changing from this syntax: $foobar, to this: $_GET['foobar'] or $_POST['foobar'] or $_COOKIE['foobar'] or etc...
    :
    :
    :

  • skylarskylar Member Posts: 82
    scope refers to where a variable resides.

    there is GLOBAL scope meaning available to the entire script..
    scope within functions (only functions have access to it)

    (im unsure about the rest.. too tired to research lol)

    You can have a variable outside of a function and have one WITHIN a function having the SAME name WITHOUT them having anything to do with one another:

    [code]

    $var = "foo";

    function myfunc(){
    $var = "bar";
    }

    myfunc()
    echo $var;


    displays:
    foo

    [/code]


    though if you declare a variable as being of GLOBAL scope within a function, it treats it as if it were part of the entire script.

    [code]

    $var = "foo";

    function myfunc(){
    global $var;
    $var = "bar";
    }

    myfunc()
    echo $var;


    displays:
    bar


    [/code]



    (untested but it probably works ;)
    [b][blue]Snoochie Boochies[/blue][/b]

Sign In or Register to comment.