[ create a new paste ] login | about

Link: http://codepad.org/m8VlgLHs    [ raw code | output | fork ]

PHP, pasted on Jan 22:
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
function get_var(){
  $var = array("site_name" => "site_value", "site_des" => "site_value2");
  foreach ($var as $key => $val){
    $GLOBALS[$key] = $val;
  }
}
function get_other(){
  get_var();
  return 'hi '.$GLOBALS["site_name"]; // hi site_value
}
print(get_other());
?>


Output:
1
hi site_value


Create a new paste based on this one


Comments: