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

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

10+ Year Member



 
Msg#: 3339662 posted 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

WebmasterWorld Senior Member eelixduppy us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 3339662 posted 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

5+ Year Member



 
Msg#: 3339662 posted 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

WebmasterWorld Administrator lorax us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3339662 posted 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