Re: global variable in function



I noticed that Message-ID: <hf8c81h348758kvt6864vpc8lp5otl7n5g@xxxxxxx>
from Andy Hassall contained the following:

><?php
>$myvariable = 'x';
>echo $myvariable;
>
>function f()
>{
> global $myvariable;
> echo $myvariable;
>}
>?>

and of course you'll have to call the function.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
.



Relevant Pages

  • Re: variable problem in address book script
    ... Geoff Berrow wrote: ... echo 'PHP_SELF'; ... faults in the original script and error reporting set to E_ALL than your ... This code will retrieve the variables, and will check for php.ini settings and consider if the php is an outdated version or those of the newer line. ...
    (alt.php)
  • Re: PHP Programmers wanted
    ... >teaching a college course for PHP. ... Hey, me too. ... Geoff Berrow (put thecat out to email) ...
    (comp.lang.php)
  • Re: What the hell is C-Sharp?
    ... tinyurl.com - PHP and MySql ... Geoff Berrow (put thecat out to email) ...
    (comp.lang.php)
  • Re: Slightlly OT - Bingo problem
    ... > Geoff Berrow wrote: ... Is it possible to write an algorithm ... echo ''."\n"; ... <?php echo 'Just another PHP saint'; ...
    (comp.lang.php)
  • Re: My head hurts...
    ... >the javascript and echo? ... Geoff Berrow (put thecat out to email) ... It's only Usenet, no one dies. ...
    (comp.lang.php)