RE: [PHP-DB] Local to Global Variables

From: Date: Thu, 11 Apr 2002 08:13:46 +0000
Subject: RE: [PHP-DB] Local to Global Variables
Groups: php.db 
Request: Send a blank email to php-db+get-18418@lists.php.net to get a copy of this message
if it is within a function, then you should define the var outside the function, then inside the function you can do this; $foo = "bar"; function foobar() { global $foo; $foo .= " bar"; } echo $foo // will output "bar bar"; HTH Beau // -----Original Message----- // From: eat pasta type fasta [mailto:php@finalbanana.com] // Sent: Thursday, 11 April 2002 4:17 PM // To: php-db@lists.php.net // Subject: [PHP-DB] Local to Global Variables // // // Not 100% DB related but soon // // I am processing a text file by looking for strings which // later depending // on the findings will be submitted to db // // my problems is that in one if statemant I find a piece of // text and need // another statment to use it later, but it seems that the // variable declared // to the found string remains local. // // Is there a way to set variables from within functions/if // statements so // they become available to all. // // Thnaks in advance // // R> // // -- // PHP Database Mailing List (http://www.php.net/) // To unsubscribe, visit: http://www.php.net/unsub.php //

« previous php.db (#18418) next »