Re: Making varibles (more than one) with a function.

From: Date: Thu, 23 May 2002 21:36:36 +0000
Subject: Re: Making varibles (more than one) with a function.
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-98996@lists.php.net to get a copy of this message
Because global is specific to the SCOPE not to the variable - variables themselves aren't tagged as global. If you add global $text; in your echoo() function it will work. Alternatively, you could replace echo $text; with echo $GLOBALS['text']; in your echoo() function. See http://www.php.net/manual/en/language.variables.php for more info. -steve At 3:17 PM -0600 5/23/02, David Duong wrote:
If that works than the why does test file I tried previously to making the post return a $text does not exist error? <? echoo(); function test() { $text = "Testing"; global $text; } function echoo() { test(); echo $text; } ?> "Sqlcoders.Com Programming Dept" <coders@sqlcoders.com> wrote in message news:009f01c20241$f05aaf80$6520fea9@dw...
Sqlcoders.com Dynamic data driven web solutions ----- Original Message ----- From: "David Duong" <davidduong1@hotmail.com> To: <php-general@lists.php.net> Sent: May 22 2002 04:21 PM Subject: [PHP] Making varibles (more than one) with a function.
I am aware that return can return strings but is their a set global or a function similar to return?
hi there!, There sure is, it's called global. Usage: global $variable_a; global $variable_b; global $variable_c; ... HTH, Dw.
-- +------------------------------------------------------------------------+ | Steve Edberg sbedberg@ucdavis.edu | | University of California, Davis (530)754-9127 | | Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ | +------------------------------------------------------------------------+ | "If only life would imitate toys." | | - Ted Raimi, March 2002 | | - http://www.whoosh.org/issue67/friends67a.html#raimi | +------------------------------------------------------------------------+

« previous php.general (#98996) next »