On Mon, 2007-12-24 at 12:13 -0500, tedd wrote:
> At 4:18 PM +0200 12/19/07, Sancar Saran wrote:
> > > that said, avoid globals like the plague - sometimes you may come up with
> >> a situation where using a global is really necessary - such situations
> >> should be the exception rather than the
Hello Tedd,
Here my opinoins
First of all, I ask this question to is there any technical dead end for using
$GLOBALS directly.
It seems not.
And I believe other arguments was closely connected to coding style.
I'm self learner, I learn evrything about computers, programming (that means
PHP)
At 4:18 PM +0200 12/19/07, Sancar Saran wrote:
> that said, avoid globals like the plague - sometimes you may come up with
a situation where using a global is really necessary - such situations
should be the exception rather than the rule, often if your thinking of
using a global there is an
example code
// current code
//--- Set DB
$GLOBALS['db'] = NewADOConnection($GLOBALS['c']['db']['type'].'://'.
$GLOBALS['c']['db']['user'].':'.$GLOBALS['c']['db']['pass'].'@'.$GLOBALS['c']
['db']['host'].'/'.$GLOBALS['c']['db']['name']);
$ADODB_FETCH_MODE = ADODB_FETCH_NUM; // Fastest Get Method
On Dec 21, 2007 2:46 PM, Robert Cummings <[EMAIL PROTECTED]> wrote:
> On Fri, 2007-12-21 at 12:35 -0600, Philip Thompson wrote:
> > On Dec 20, 2007, at 11:24 AM, Sancar Saran wrote:
> >
> > > Hello All,
> > >
> > > Thanks for joining the conversation. It seems there where no real
> > > technical
>
On Fri, 2007-12-21 at 12:35 -0600, Philip Thompson wrote:
> On Dec 20, 2007, at 11:24 AM, Sancar Saran wrote:
>
> > Hello All,
> >
> > Thanks for joining the conversation. It seems there where no real
> > technical
> > dead end for using $GLOBALS directly.
> > Using $GLOBALS directly very simila
On Dec 20, 2007, at 11:24 AM, Sancar Saran wrote:
Hello All,
Thanks for joining the conversation. It seems there where no real
technical
dead end for using $GLOBALS directly.
Using $GLOBALS directly very similar to coding standarts. It just up
to you.
Also I try explain my enviroment a l
Richard Lynch wrote:
On Wed, December 19, 2007 11:22 am, Stut wrote:
well, if you have a long and complex function declaration which
begins
with global $whatever, and then all over the function $whatever is
used,
some dozens of lines later when looking for something in the code
you
might not hav
On Wed, December 19, 2007 11:22 am, Stut wrote:
>> well, if you have a long and complex function declaration which
>> begins
>> with global $whatever, and then all over the function $whatever is
>> used,
>> some dozens of lines later when looking for something in the code
>> you
>> might not have a
Hello All,
Thanks for joining the conversation. It seems there where no real technical
dead end for using $GLOBALS directly.
Using $GLOBALS directly very similar to coding standarts. It just up to you.
Also I try explain my enviroment a liddle bit.
First of all my function declarationgs gonna
Zoltán Németh wrote:
2007. 12. 19, szerda keltezéssel 10.25-kor Richard Lynch ezt írta:
On Wed, December 19, 2007 10:14 am, Stut wrote:
Richard Lynch wrote:
On Wed, December 19, 2007 4:13 am, Sancar Saran wrote:
I want know to you opinions about using $GLOBALS directly.
like
$GLOBALS['mySt
2007. 12. 19, szerda keltezéssel 10.25-kor Richard Lynch ezt írta:
> On Wed, December 19, 2007 10:14 am, Stut wrote:
> > Richard Lynch wrote:
> >> On Wed, December 19, 2007 4:13 am, Sancar Saran wrote:
> >>> I want know to you opinions about using $GLOBALS directly.
> >>>
> >>> like
> >>>
> >>> $G
On Wed, December 19, 2007 10:14 am, Stut wrote:
> Richard Lynch wrote:
>> On Wed, December 19, 2007 4:13 am, Sancar Saran wrote:
>>> I want know to you opinions about using $GLOBALS directly.
>>>
>>> like
>>>
>>> $GLOBALS['myString'] = 'test';
>>> $GLOBALS['myArray']['this'] = 'this';
>>> $GLOBALS
On Wed, December 19, 2007 8:18 am, Sancar Saran wrote:
> Thanks for response, I'm using this aproach maybe more than one year.
> I did
> not get any problems.
>>
>> there is no real difference between 'global $foo' and
>> $GLOBALS['foo'],
>> and the second is probably more maintainance friendly (as
Richard Lynch wrote:
On Wed, December 19, 2007 4:13 am, Sancar Saran wrote:
I want know to you opinions about using $GLOBALS directly.
like
$GLOBALS['myString'] = 'test';
$GLOBALS['myArray']['this'] = 'this';
$GLOBALS['myArray']['that'] = 'that';
$GLOBALS['myClassObj] = new SomeClass;
Don't
js schreef:
> Hi Jochem,
>
> Sorry, I missed "static".
> So, getDB() would works like singleton, right?
yes - and it was just pseudo code off the top of my head, also there
are 2 slightly different ways to attack this - one is to return an
object that contains all the DB functionality (and stores
On Wed, December 19, 2007 8:14 am, js wrote:
> That wouldn't work well when you have to update multiple tables in a
> transaction.
> I think it's more maintainable to use GLOBALS than passing around dbh
> to classes/functions.
I also just use a 'global' for my db connection, for small to medium
we
On Wed, December 19, 2007 4:13 am, Sancar Saran wrote:
> I want know to you opinions about using $GLOBALS directly.
>
> like
>
> $GLOBALS['myString'] = 'test';
> $GLOBALS['myArray']['this'] = 'this';
> $GLOBALS['myArray']['that'] = 'that';
> $GLOBALS['myClassObj] = new SomeClass;
Don't.
You are
Richard Heyes schreef:
>>> I always store database handler in $GLOBALS.
>>> I think that's the best place to save request-level-global.
>>> I wonder where other people save that kind of data.
>>
>> how about a static variable inside a function or a static member of a
>> class.
>>
>> e.g.
>>
>> func
On 19/12/2007, js <[EMAIL PROTECTED]> wrote:
> Hi Jochem,
>
> Sorry, I missed "static".
> So, getDB() would works like singleton, right?
> I agree that's better method to manage dbh.
The technique is called memoization (http://en.wikipedia.org/wiki/Memoization).
-robin
--
PHP General Mailing Li
Hi Jochem,
Sorry, I missed "static".
So, getDB() would works like singleton, right?
I agree that's better method to manage dbh.
On Dec 19, 2007 11:27 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:
> js schreef:
> > That wouldn't work well when you have to update multiple tables in a
> > transaction.
I always store database handler in $GLOBALS.
I think that's the best place to save request-level-global.
I wonder where other people save that kind of data.
how about a static variable inside a function or a static member of a class.
e.g.
function getDB($args) {
static $conn = array();
js schreef:
> That wouldn't work well when you have to update multiple tables in a
> transaction.
> I think it's more maintainable to use GLOBALS than passing around dbh
> to classes/functions.
getDB() is a function that returns a database connection wrapper object not
a handle to a connection (th
Hello Jochem,
Thanks for response, I'm using this aproach maybe more than one year. I did
not get any problems.
>
> there is no real difference between 'global $foo' and $GLOBALS['foo'],
> and the second is probably more maintainance friendly (as Rob pionted out)
Yes you are right writing globa
That wouldn't work well when you have to update multiple tables in a
transaction.
I think it's more maintainable to use GLOBALS than passing around dbh
to classes/functions.
On Dec 19, 2007 11:07 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:
> please reply to the list ...
>
> js schreef:
> > I always
please reply to the list ...
js schreef:
> I always store database handler in $GLOBALS.
> I think that's the best place to save request-level-global.
> I wonder where other people save that kind of data.
how about a static variable inside a function or a static member of a class.
e.g.
function
Sancar Saran schreef:
> Hello list.
>
> I want know to you opinions about using $GLOBALS directly.
>
> like
>
> $GLOBALS['myString'] = 'test';
> $GLOBALS['myArray']['this'] = 'this';
> $GLOBALS['myArray']['that'] = 'that';
> $GLOBALS['myClassObj] = new SomeClass;
there is no real difference be
On Wed, 2007-12-19 at 12:13 +0200, Sancar Saran wrote:
> Hello list.
>
> I want know to you opinions about using $GLOBALS directly.
>
> like
>
> $GLOBALS['myString'] = 'test';
> $GLOBALS['myArray']['this'] = 'this';
> $GLOBALS['myArray']['that'] = 'that';
> $GLOBALS['myClassObj] = new SomeClass
Hello list.
I want know to you opinions about using $GLOBALS directly.
like
$GLOBALS['myString'] = 'test';
$GLOBALS['myArray']['this'] = 'this';
$GLOBALS['myArray']['that'] = 'that';
$GLOBALS['myClassObj] = new SomeClass;
Regards
Sancar
--
PHP General Mailing List (http://www.php.net/)
To u
29 matches
Mail list logo