Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #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
  #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/
  #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


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





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