[PHP] Variable scope

2011-07-14 Thread Karl DeSaulniers
Can anyone explain this to me. function sendEmail($uname,$subjField,$firstname,$lastname,$email, $reply,$e_cc,$e_bcc,$comments,$ip,$Date,$time){ $uname = trim($uname); $subjField = trim($subjField); $firstname = trim($firstname); $lastname = trim($lastname); $email =

Re: [PHP] Variable scope

2011-07-14 Thread Tamara Temple
On Jul 14, 2011, at 3:54 PM, Karl DeSaulniers wrote: Can anyone explain this to me. function sendEmail($uname,$subjField,$firstname,$lastname,$email, $reply,$e_cc,$e_bcc,$comments,$ip,$Date,$time){ $uname = trim($uname); $subjField = trim($subjField); $firstname =

[PHP] Variable Scope with require_once

2009-04-27 Thread user
Hello, all. I have a working app that runs in PHP 4.4.9 on the server. I develop the app on my local environment, which runs PHP 5.2.6. The setup is thus: From my index, I have require_once('config.php'); require_once('dbstuff.php'); config.php looks like this: ?php $db_host =

[PHP] Variable Scope problem passing function parameters

2008-12-18 Thread Jim McIntyre
I'm new to PHP 5 and classes, but I've done a lot of ActionScript. I'm trying to use PHPMailer inside my own class (a service for AMFPHP). I'm having problems getting the data that'spassed into my class's send() method to the instance of the PHPMailer. Basically, I have this: class EmailAMF

Re: [PHP] Variable Scope problem passing function parameters

2008-12-18 Thread metastable
Jim McIntyre wrote: I'm new to PHP 5 and classes, but I've done a lot of ActionScript. I'm trying to use PHPMailer inside my own class (a service for AMFPHP). I'm having problems getting the data that'spassed into my class's send() method to the instance of the PHPMailer. Basically, I have

Re: [PHP] Variable Scope problem passing function parameters

2008-12-18 Thread Jim McIntyre
metastable wrote: Jim McIntyre wrote: $phpMail = new PHPMailer(); $phpMail-From = $from; $phpMail-AddAddress($this-to); $phpMail-Subject = $subject; $phpMail-Body = $body; return $phpMail-Send(); $this - to it has no meaning in the scope of your class. Apparently,

[PHP] SOLVED Re: [PHP] Variable Scope problem passing function parameters

2008-12-18 Thread Jim McIntyre
Jim McIntyre wrote: metastable wrote: Jim McIntyre wrote: $phpMail = new PHPMailer(); $phpMail-From = $from; $phpMail-AddAddress($this-to); $phpMail-Subject = $subject; $phpMail-Body = $body; return $phpMail-Send(); Never mind - I found the problem. It was a lowly

Re: [PHP] Variable Scope from child to parent

2008-05-15 Thread Andrew Ballard
Ok, I forgot to reply-all to the list. Here we go again. On Wed, May 14, 2008 at 6:33 PM, Tyson Vanover [EMAIL PROTECTED] wrote: I am trying to get a child class to pass an array of valid keys to it's parent when the constructor is run, and the parent appends the data to one of it's array of

[PHP] Variable Scope from child to parent

2008-05-14 Thread Tyson Vanover
I am trying to get a child class to pass an array of valid keys to it's parent when the constructor is run, and the parent appends the data to one of it's array of valid keys. Then it walks through an array pulling out values that have valid keys, and putting them in an array for processing

Re: [PHP] Variable Scope from child to parent

2008-05-14 Thread Gabriel Sosa
tyson i never saw self::$this-vkeys doing this you actually are callig the var inside $this-vkeys do self::$vkeys as static or $this-vkeys as object don't mix regards On Wed, May 14, 2008 at 7:33 PM, Tyson Vanover [EMAIL PROTECTED] wrote: I am trying to get a child class to pass an array

[PHP] variable scope in nested functions

2002-12-09 Thread Filippo Veneri
Is there a way to access a variable defined in a function from a nested function, without putting the variable in the global scope? Perhaps some code will make my question clearer: function enclosing() { $variable1; function enclosed() { can I access $variable1

[PHP] Variable scope

2002-05-04 Thread George Nicolae
I have the following code: ? function a($var_a) { b(); } function b() { global $var_a; echo $var_a; } a(hello word!); ? why function b() don't echo anything? can I resolve this problem without calling b($var_a)? Best regards, George Nicolae IT Manager ___ PaginiWeb.com -

Re: [PHP] Variable scope

2002-05-04 Thread Jason Wong
On Thursday 14 March 2002 21:53, George Nicolae wrote: I have the following code: ? function a($var_a) { b(); } function b() { global $var_a; echo $var_a; } a(hello word!); ? why function b() don't echo anything? Because $var_a has not, at any point, been defined in the global

Re: [PHP] Variable scope

2002-05-04 Thread George Nicolae
Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Thursday 14 March 2002 21:53, George Nicolae wrote: I have the following code: ? function a($var_a) { b(); } function b() { global $var_a; echo $var_a; } a(hello word!); ? why function

Re: [PHP] Variable scope

2002-05-04 Thread Jason Wong
On Friday 15 March 2002 00:34, George Nicolae wrote: Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Thursday 14 March 2002 21:53, George Nicolae wrote: I have the following code: ? function a($var_a) { b(); } function b() { global

Re: [PHP] Variable scope

2002-05-04 Thread Miguel Cruz
On Thu, 14 Mar 2002, George Nicolae wrote: ? function a($var_a) { b(); } function b() { global $var_a; echo $var_a; } a(hello word!); ? why function b() don't echo anything? Because $var_a has not, at any point, been defined in the global scope. how i declare

[PHP] variable scope

2002-03-12 Thread David Johansen
I have a little chunk of code that checks to see if a variable exists and if not then it sets it. It goes like this: if (empty($page)) { $page = login; } I then end that part of the php script after doing what I need to. Then I start up again on the same html page and I assumed that $page

Re: [PHP] variable scope

2002-03-12 Thread Lars Torben Wilson
On Tue, 2002-03-12 at 14:38, David Johansen wrote: I have a little chunk of code that checks to see if a variable exists and if not then it sets it. It goes like this: if (empty($page)) { $page = login; } I then end that part of the php script after doing what I need to. Then I

Re: [PHP] variable scope

2002-03-12 Thread David Johansen
Something most have just been wigging out or something because I can't get it to do it again. Maybe I just did something wrong, but it seems to be working now. Thanks for the help though, Dave Lars Torben Wilson [EMAIL PROTECTED] wrote in message

[PHP] variable scope / preg_replace_callback question

2001-12-03 Thread Peter Bowyer
Hi, Does anyone know of a way of passing other variables to the function being called by preg_replace_callback? For instance, I have the following code: function smarty_compile_lang($tpl_source) { // en.php contains a very large array, $_lang include_once '/home/test/en.php';

Re: [PHP] variable scope / preg_replace_callback question

2001-12-03 Thread Andrey Hristov
function _compile_lang($key){ global $_lang; return $_lang[$key[1]]; } // End _compile_lang HTH Regards, Andrey Hristov - Original Message - From: Peter Bowyer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, December 03, 2001 3:45 PM Subject: [PHP] variable scope

[PHP] Variable scope problem

2001-03-28 Thread Joe Nelson
I have two functions like the ones below. If the first one creates a variable as global, shouldn't it be accesible to the second function? function setGlobal() { global $test; $test = "123"; } function getGlobal() { global $test; echo $test; } -- PHP

RE: [PHP] Variable scope problem

2001-03-28 Thread Jason Lotito
-Original Message- From: Joe Nelson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 28, 2001 6:17 PM To: php list Subject: [PHP] Variable scope problem I have two functions like the ones below. If the first one creates a variable as global, shouldn't it be accesible

[PHP] Variable scope

2001-03-10 Thread Martin Skjöldebrand
How do I make a variable persistent between webpages? V e r b a l -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]

RE: [PHP] Variable scope

2001-03-10 Thread Christian Joergensen
-Original Message- From: Martin Skjoldebrand [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 10, 2001 3:22 PM To: [EMAIL PROTECTED] Subject: [PHP] Variable scope How do I make a variable persistent between webpages? Take a look at the session functions described at: http://php.net

[PHP] variable scope -- unsetting vars inside functions

2001-03-01 Thread Michael A. Smith
When a function finishes execution does it automatically clean up its local variables or should I manually unset() them? For example: function do_something() { $local_var = 'something really big...'; return true; } Does $local_var immediately vanish from existence when do_something

[PHP] Variable Scope

2001-01-18 Thread Karl J. Stubsjoen
I'm a bit troubled with the fact that variables declared at the top of your script are not then global to functions within that script. That in order to see that variable within a function you'd have to declare it as global in the function (understanding that the variable could have been set at

Re: [PHP] Variable Scope

2001-01-18 Thread Philip Olson
A nice explanation, via the mind of Lars Torben Wilson, exists here : http://marc.theaimsgroup.com/?l=php-generalm=97717398101040w=2 Also, you may want to check out : http://www.php.net/manual/en/language.constants.php http://www.php.net/manual/en/function.define.php Philip On

Re: [PHP] Variable Scope

2001-01-18 Thread Philip Olson
How about allowing for metaPasses within the castle? Am sure this topic came up, what's the conclusion? Philip On Thu, 18 Jan 2001, Rasmus Lerdorf wrote: I'm a bit troubled with the fact that variables declared at the top of your script are not then global to functions within that

Re: [PHP] Variable Scope

2001-01-18 Thread Michael Kimsal
I find the VB way (or VBScript anyway) of doing functions backwards. My recollection is that if I call a function blah... x = blahfunction('cow') 'blahfunction' itself has to be defined *in* the function to get the value back. I can't even think of a good example, it's so foreign to me and I