Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 17th, 2003, 05:21 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 101
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Moharo
Default $_SESSION vs. $_GLOBALS

:D

i was wondering which is better for storing variables - $_SESSION or $_GLOBALS array?
if you guys know any interesting links where can i read more about $_SESSION array would be nice. and also another questions: is $_SESSION array ok if i store an array in it of maximum size of 200; maybe the last question was little bit funny but i'm doing an examination system sort of like the Cisco Network Academy has and i have to keep in mind that everything that i do has to be optimized and secure. so maybe you guys have any suggestions on how to improve response time and all the other stuff... thanx

:D:D



the genuine genius
__________________
www.campusgrind.com - college portal
Reply With Quote
  #2 (permalink)  
Old August 18th, 2003, 01:54 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, there's no such thing as $_GLOBALS -- I assume you mean $GLOBALS (no underscore!).

The reason you'd store variables in one and not the other basically boil down to one question: Do you need the value of these variables to persist across page requests?

If so, you need sessions. That's what sessions are.

If not, store the variable in whatever place is most appropriate. If you're within function or class scope, you typically don't store stuff in global scope. Store it locally within that class or function.

HTH!


Take care,

Nik
http://www.bigaction.org/
Reply With Quote
  #3 (permalink)  
Old August 18th, 2003, 02:27 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 101
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Moharo
Default

thanks, that sure helped :D:D:D:D

the genuine genius
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
$_SESSION error in login.php Mind Games Beginning PHP 1 June 2nd, 2008 03:43 PM
$_Session cant pass Value kelz84 Beginning PHP 1 March 21st, 2006 09:25 AM
Difficulty with $_SESSION mall9@hotmail.com Beginning PHP 11 March 11th, 2006 05:41 PM
Is it possible to set $_Session Variables in java rinventive Java Basics 1 February 13th, 2006 05:41 AM
Storing binary data in $_SESSION variables richard.york Pro PHP 0 August 30th, 2003 05:23 PM



All times are GMT -4. The time now is 05:42 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.