Internet Marketing Blog
Home      Archives      Tools      Advertising      About      Contact      Free Shipping Subscribe to our Full RSS Feed

 

Switch Statement Trumps If Statement

A couple weeks ago I posted about creating jump links in php for large affiliate sites. In the post, I linked to a tutorial on how to create the clean looking jump links.

After my post, I showed the code to my web developer brother, Jesse Knowles and he let me know that there is a much more efficient way to accomplish the same thing.

The problem with the code I was using is that it was hundreds of if statements in a row. If the condition was met early in the jump file, the rest of the if statements would still be run. This would be a huge waste of resources, especially in a jump file with over 300 if statements like I had.

Instead, Jesse had me use a switch statement with a break after each condition. This means that once the condition is met, the rest of the file is not executed. Not only did this new method save on resources, it created a file that had a smaller file size. Win. Win.

Download the code.


Spread the word: del.icio.us Digg Furl Reddit StumbleUpon Technorati

If you like this post, then consider subscribing to our full feed RSS.


       Posted in: Affiliate Marketing, Web Development
     by: Luke Knowles
Your Thoughts? [ 0 ]      
December 18, 2007       
 
 
   
  Leave a Comment
Please respond with a comment using the form below.

  
  
  
Comments

 
   
 
   
  Internet Marketing Campaigns  
  Sony Bravia Campaign Goes Viral Again
Dove Onslaught Viral Video
Into the Wild Internet Marketing Cross Promotion
Halo 3 Internet Marketing Campaign
Hundai - Lattes vs Airbags "Think About It"
Heinz Top This TV Challenge
McDonalds Uses Viral youTube Video in its Latest TV Ad
The Simpsons Movie Marketing Madness
 
  Must Read Posts  
  Free Shipping Web Site Launches
SEO For Wordpress Series
How to Make Money with Facebook
Everything You Need to Know About rel=nofollow
7 Tips For Starting Your Own Facebook Group
Internet Marketing Case Study: WH Bed & Breakfast
9 Ways to Improve Google Image Search Rankings
Free Samples Equals Viral Marketing Success
4 Reasons Not To Put Your Company in the Wikipedia
Learn How to Make Facebook Applications
Easy Auction Ads Wordpress Plugin
 
  Categories  
 
 
  RSS Feed  
  Subscribe to RSS
Subscribe by Email
 
  Search  
 
 
  Sites  
   
  Commenters
 
Rani (2)
 
 
Home      Archives      Tools      Advertising      About      Contact      Coupons © 2008 Virtual Marketing Blog