Declaring a global variable inside a function

you have to define the global var in the second function as well..

// global scope
$ref_id = 1;

grabReferral($rid){
   global $ref_id;
   $ref_id = $rid;
}

someOtherFunction(){
    global $ref_id;
    sendValue($ref_id);
}

felix

Leave a Comment