Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Which is faster Get or Session

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

Full Member

10+ Year Member

joined:June 16, 2004
votes: 0

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




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

Senior Member

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 12, 2005
votes: 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.
12:10 pm on May 15, 2007 (gmt 0)

Preferred Member

5+ Year Member

joined:July 31, 2006
votes: 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 :)

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

Senior Member from US 

WebmasterWorld Senior Member lorax is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Mar 31, 2002
votes: 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.