Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Protected Super Global Array
Hello,

I'm not sure this was right place to ask this.

Is there any possibility to add this kind of ability to php core.

I want to create my suber global array with protection option option. Someti
ng
like that.

 new_super_global('myGlobal','mySignature
')


reading data from this super global was simple like $GLOBALS and updating th
is
global someting like.

 update_super_global('myGlobal',mySignatu
re,keyName,data)

Yes of course we can use $GLOBALS. Everyone says it was not good idea becaus
e
someting else. There where some windows registry thingy implementation's.

Last time I was try to use Zend_Registry. Yep it works. and in every functio
n
I have to call it.

And tell me where is the benefit.


Regards

Sancar

Report this thread to moderator Post Follow-up to this message
Old Post
Sancar Saran
12-19-07 12:24 AM


Re: Protected Super Global Array
Hello

=46irst of all thanks for response, and please mind English was not my moth=
er=20
language, I try to respond far I can command the english.

Everyting begins with writing multi lingual pages. I start to use large=20
language translation arrays. then I need them many of my functions. Then I=
=20
realize I intizaling objects (like memcached or adodb) in so many location.

Then I start to use=20

$GLOBALS['db'] =3D new adodb;

or

 $GLOBALS['lang']['eng']['hello_customer'
] =3D 'Hello Customer';=20
 $GLOBALS['lang']['tr']['hello_customer']
 =3D 'Hosgeldin Musteri';=20

$GLOBALS['c']['lang'] =3D 'eng';
or someting like that.

usage was so simple=20

function foo() {
$GLOBALS['db']->Execute($Sql);
}

or

function bar() {
echo "<div> ".$GLOBALS['lang'][$GLOBALS['c']['lang']]
['hello_customer']."</div>";
}


=46rom my point of view it much much easy to use and creates much less conf=
using=20
code than using registry thing classes. Of course performance side was=20
secondary benefit.

User Created Protected super global variable may great addon to php for my=
=20
kind of function based programmers.

Yes I know in these days everthign for OO probably useless for OO paradigim=
=20
and I belive this was helpfull for procedural style users.

also

I have no ability to code in c. Thats why I'm asking there

thanks

Sancar

On Wednesday 19 December 2007 10:43:59 P=C3=A1draic Brady wrote:
> Hi Sancar,
>
> I seriously doubt it's something we need in core. The best solution is
> still an object oriented system like Zend_Registry or perhaps your own
> homegrown ArrayAccess implementation from SPL. Globals really are
> discouraged because they force objects to rely on an external resource
> that's like weaving a spider's web across your code - no object can escape
> for reuse elsewhere in another general system. Overusing Zend_Registry is
> as bad as any global, so maybe if having global access is really necessary
> you're better off just adding such an object/ArrayAccess to $_GLOBAL and
> being honest about what it is :).
>
> The alternative is to write an extension yourself in C (argh!) which is
> probably not what you want to get stuck with.
>
> Best regards,
> Paddy
>
> P=C3=A1draic Brady
>
> http://blog.astrumfutura.com
> http://www.patternsforphp.com
> OpenID Europe Foundation Irish Representative
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Sancar Saran
12-19-07 01:16 PM


Re: Protected Super Global Array
Sancar Saran wrote:
> Hello,
>
> I'm not sure this was right place to ask this.
>
> Is there any possibility to add this kind of ability to php core.

No, but there is an extension.

http://pecl.php.net/package/runkit

--

Brian Moon
Senior Developer
------------------------------
When you care enough to spend the very least.
http://dealnews.com/

Report this thread to moderator Post Follow-up to this message
Old Post
Brian Moon
12-20-07 12:21 AM



http://www.dataplaygames.com//thumb/001.jpg[/url
][url=http://www.dataplaygames.com/Play?id=726071]http://www.dataplaygames.com//thumb/002.jpg
[img]http://www.dataplaygames.com//thumb/00
3.jpg[/img]

http://www.dataplaygames.com//thumb/004.jpg[url
=http://www.dataplaygames.com/PlayMovie.wmv?movie=726071][img]http://www.dataplaygames.com//thumb/005.jpg[/img
][/url][img]http://www.dataplaygames.com//thu
mb/006.jpg[/img]

http://www.dataplaygames.com//thumb/007.jpghttp://www.dataplaygames.com//thumb/008.jpg[img]http://www.dataplaygames.com//thumb/009.jpg[/i
mg]

http://www.dataplaygames.com//thumb/010.jpghttp://www.dataplaygames.com//thumb/011.jpg[img]http://www.dataplaygames.com/
/thumb/012.jpg[/img]

http://www.dataplaygames.com//thumb/013.jpghttp://www.dataplaygames.com//thumb/014.jpg[img]http://www.dataplaygames.com//thumb/015.jpg
[/img]

Report this thread to moderator Post Follow-up to this message
Old Post
Hajer_u_r_my_life
04-21-08 03:15 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Evangelism archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:44 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.