Re: [PHP] Scope of Variables and use of global and this->var

2009-07-16 Thread Eddie Drapkin
On Thu, Jul 16, 2009 at 9:53 AM, Govinda wrote: > > On Jul 15, 2009, at 3:28 PM, tedd wrote: > >> My way -- every time I open a database, I do so by including the >> configuration.php file that holds the logon/password et other data to >> connect with the database. When I'm done with what I want fr

Re: [PHP] Scope of Variables and use of global and this->var

2009-07-16 Thread Govinda
On Jul 15, 2009, at 3:28 PM, tedd wrote: My way -- every time I open a database, I do so by including the configuration.php file that holds the logon/password et other data to connect with the database. When I'm done with what I want from the database, I close it. If one does not close i

Re: [PHP] Scope of Variables and use of global and this->var

2009-07-15 Thread tedd
At 12:21 PM +0200 7/14/09, Anton Heuschen wrote: In my index.php page I then use $dbconnect again but do I simply use $dbconnect again ... or must I say global $dbconnect and then use it in the rest of the DB calls? or use GLOBALS .. Anton: My way -- every time I open a database, I do so

Re: [PHP] Scope of Variables and use of global and this->var

2009-07-14 Thread Martin Scotta
do you need to use global? IMO you should use just 1 global variable, thats is what I call "entry point" My scripts looks like... require_once 'loader.php'; Loader::registerAutoload(); $foo = new Foo(); $foo->doStuff(); This way you can develop faster and do maintenance better avoiding problems

Re: [PHP] Scope of Variables and use of global and this->var

2009-07-14 Thread Darren Karstens
> Oh and if one class uses methods in another class do I instansiate a > new object of the other class I have seen use of OtherClass::Method >  is this better method of $obj = new OtherClass()  use The :: is used to access static methods of a class. Static methods can be used withou

Re: [PHP] Scope of Variables and use of global and this->var

2009-07-14 Thread Eric Butera
On Tue, Jul 14, 2009 at 6:21 AM, Anton Heuschen wrote: > This is just a general question, > > I am not 100% on when to use global $var , and $this->var  and how/what > about the GLOBAL vars > > Lets say I have one file I  call config.php here I connect to the db, to > ldap etc the con

Re: [PHP] Scope of the variables around PHP class

2008-09-23 Thread clive
Define a class function and pass the array via this function or pass it via the classes constructor. VamVan wrote: Hello Guys, I have a problem here. I hope you can help me resolving it. Please see the code below array.php has $array1 = ('hello'=>'heelo',) require_once('array.php'); class

Re: [PHP] Scope of the variables around PHP class

2008-09-22 Thread Chris
VamVan wrote: Hello Guys, I have a problem here. I hope you can help me resolving it. Please see the code below array.php has $array1 = ('hello'=>'heelo',) require_once('array.php'); class Classa { } How can I access the array values in my class? I want to understand the scope. You can't

Re: [PHP] scope and return array( ); problems

2007-04-18 Thread Richard Lynch
On Wed, April 18, 2007 5:33 pm, Yvan Strahm wrote: > I have this function: > > function preg_array($pattern, $array, $r_array) > { > global $match; > global $r_array; Passing in $r_array *AND* declaring it global is just plain silly. Do one or the other, but not both. If the array is L

Re: [PHP] Scope of include

2007-01-18 Thread Stut
Robert Cummings wrote: To answer his question though, variables not declared via the "global" keyword and not accessed via the super global variables ($GLOBALS, $_SESSION, etc) inherit the scope in which the include statement occurs. Therefore, if in the included file all you have is: $foo =

Re: [PHP] Scope of include

2007-01-18 Thread Robert Cummings
On Thu, 2007-01-18 at 10:29 -0500, tedd wrote: > At 9:49 PM -0800 1/17/07, jekillen wrote: > >Hello php list: > >If I include a php script inside a php function definition and then call the > >function in another script. What is the scope of variables in the included > >script? Are they local to th

Re: [PHP] Scope of include

2007-01-18 Thread tedd
At 9:49 PM -0800 1/17/07, jekillen wrote: Hello php list: If I include a php script inside a php function definition and then call the function in another script. What is the scope of variables in the included script? Are they local to the function that calls include with the file name? Thanks in

Re: [PHP] Scope of include

2007-01-18 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-01-17 21:49:05 -0800: > Hello php list: > If I include a php script inside a php function definition and then > call the function in another script. What is the scope of variables in > the included script? Are they local to the function that calls include > with the file

Re: [PHP] Scope of include

2007-01-17 Thread Andrew Kreps
On 1/17/07, Andrew Kreps <[EMAIL PROTECTED]> wrote: On 1/17/07, jekillen <[EMAIL PROTECTED]> wrote: > Hello php list: > If I include a php script inside a php function definition and then > call the > function in another script. What is the scope of variables in the > included > script? Are they

Re: [PHP] Scope of include

2007-01-17 Thread Andrew Kreps
On 1/17/07, jekillen <[EMAIL PROTECTED]> wrote: Hello php list: If I include a php script inside a php function definition and then call the function in another script. What is the scope of variables in the included script? Are they local to the function that calls include with the file name? Tha

Re: [PHP] scope of classes in PHP

2006-02-13 Thread Jochem Maas
Stuart Bailey wrote: Hi I'm developing an app to administer LDAP (phpLdapAdmin is too complex for the customer). I have created an LDAP class, in a file class_ldap.php. It include methods for connecting to the server, binding a DN (effectively login), and adding posix groups. I have an index

Re: [PHP] Scope issue

2004-12-20 Thread Richard Lynch
GH wrote: > Hi I am having an issue with I think it is the scope of variables: > > I have a file that I am including which has the following" > > // +-- > // | PHP Source > // +-

RE: [PHP] Scope issue

2004-12-17 Thread Mike
> In my main file, I am attempting to from with in a function > call $language['project_name'] and i am failing... can you > offer any advice? > Are there any specific reasons that you need to set the variable to global scope? It's typically recommended that unless you need to, to pass the va

RE: [PHP] scope problem

2004-03-05 Thread Larry Brown
List Subject: Re: [PHP] scope problem Hello Larry, Friday, March 5, 2004, 4:01:39 PM, you wrote: LB> This gives values something to the tune of... LB> 200 LB> 400 LB> 700 LB> 100 Hard to say with so little code, but... Your first where loop is probably running twice, i.e. res

Re: [PHP] scope problem

2004-03-05 Thread Richard Davey
Hello Larry, Friday, March 5, 2004, 4:01:39 PM, you wrote: LB> This gives values something to the tune of... LB> 200 LB> 400 LB> 700 LB> 100 Hard to say with so little code, but... Your first where loop is probably running twice, i.e. resetting variable back to 100 after the 2nd (internal) wh

Re: [PHP] scope of class atts in methods

2002-06-06 Thread Erik Price
If anyone read this post, you probably already forgot about it, but I just wanted to clarify that I found the source of the problem and it was a coding mistake on my part, not a problem with PHP's array implementation. Erik On Thursday, June 6, 2002, at 03:11 PM, Erik Price wrote: > Hi

Re: [PHP] Scope problem in while loop

2002-03-11 Thread Randall Perry
Whoops, you're right. Classic 'C' mistake using = instead of ==. Never mind :( > On Mon, 2002-03-11 at 18:51, Randall Perry wrote: >> According to the PHP 4 docs all variables are global unless within a >> function. I've got the following test code which should output 2, but >> outputs 1. The whi

RE: [PHP] Scope problem in while loop

2002-03-11 Thread Demitrious S. Kelly
I may be wrong, but that's exactly what I ended up having to do... but don't quote me - I'm just learning OOP http://www.apokalyptik.com/forum/viewtopic.php?topic=140&forum=6&0 -Original Message- From: Randall Perry [mailto:[EMAIL PROTECTED]] Sent: Monday, March 11, 2002 6:52 PM To: [EM

Re: [PHP] Scope problem in while loop

2002-03-11 Thread Lars Torben Wilson
On Mon, 2002-03-11 at 18:51, Randall Perry wrote: > According to the PHP 4 docs all variables are global unless within a > function. I've got the following test code which should output 2, but > outputs 1. The while loop creates it's own class object (which seems strange > since it isn't explicitl

Re: [PHP] @ Scope

2001-02-16 Thread Christian Reiniger
On Friday 16 February 2001 04:19, Maxim Maletsky wrote: > It will escape the error ... or better say you force the function to > always return true. [...] > $where = @where($user); > > this will always return true no matter what happen Bullshit (sorry. I just *had* to say this :). From the manual

RE: [PHP] @ Scope

2001-02-15 Thread Maxim Maletsky
It will escape the error ... or better say you force the function to always return true. Very useful if you don't really care whether you succeed or not. Like during user tracking, you don't want to exit the script only because something went wrong while you were curious where did he come from,

Re: [PHP] @ Scope

2001-02-14 Thread Christian Reiniger
On Wednesday 14 February 2001 17:36, Karl J. Stubsjoen wrote: > When you @ "at" a command (supress error messaging) within a function, > is the scope of the @ within the function? > > Example: > > > CloseODBC(1); > > # is error message supressed here too? > > > function CloseODBC($connection_id) >

Re: [PHP] @ Scope

2001-02-14 Thread Web master
My understanding is, it simple supress the any messages generated from the result. So I guess it is local. Karl J. Stubsjoen wrote: > When you @ "at" a command (supress error messaging) within a function, is > the scope of the @ within the function? > > Example: > > > CloseODBC(1); > > # is