homepage Welcome to WebmasterWorld Guest from 54.161.155.142
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Which is faster Get or Session
BlackRaven




msg:3339664
 1:35 am on May 15, 2007 (gmt 0)

which of the if statements is faster,
note that the $_GET if statement does not need session_start()

if($_GET['member']==1)

or

session_start();
if(isset($_SESSION['member']))

 

eelixduppy




msg:3339670
 1:40 am on May 15, 2007 (gmt 0)

You probably won't even notice a difference in them, but I'd say the first example. The real question is, however, which one suits your needs better? This depends on what you are trying to do.

joelgreen




msg:3339969
 12:10 pm on May 15, 2007 (gmt 0)

Think first one is faster because second one has to run two more functions. But as eelixduppy said you may not even notice a difference.

Additionally session may expire, and _SESSION['....'] would not work, while $_GET['...'] will work :)

lorax




msg:3342323
 6:50 pm on May 17, 2007 (gmt 0)

Partly depends upon the number of elements in each array. If you're carrying a lot of SESSION variables and only have a few GET vars then GET should be quicker. But as was pointed out, sometimes you need to use SESSION instead of GET for security and/or other reasons.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved