global



Hi, I have the following code...

##################
$myvar = "test";

function myfunc() {
global $myvar;
echo $myvar;
}
##################

However, when echoing $myvar it is blank. Can anybody tell me what I am doing wrong?
.




Relevant Pages

  • Re: global
    ... >function myfunc() { ... when echoing $myvar it is blank. ... Prev by Date: ...
    (comp.lang.php)
  • Re: How to set environment variable via JScript?
    ... I tried your batch and script; ... SET MYVAR=Original value of MYVAR ... echo Value of MYVAR is: ...
    (microsoft.public.scripting.jscript)
  • using the return code of a statement directly
    ... Syntax error: word unexpected ") ... screen, but $myvar doesn't get the expected value. ... $ echo "xxx$yyy" ... echo "not zero" ...
    (comp.unix.shell)
  • Re: How to set environment variable via JScript?
    ... Use StdOut to send values back to the batch file and change environmental ... SET MYVAR=Original value of MYVAR ... echo Value of MYVAR is: ... echo Running script ... ...
    (microsoft.public.scripting.jscript)
  • Re: using the return code of a statement directly
    ... Under FreeBSD using the sh shell, what is the proper way (or rather, is ... Syntax error: word unexpected ") ... screen, but $myvar doesn't get the expected value. ... $ echo "xxx$yyy" ...
    (comp.unix.shell)