|
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:
If you like this post, then consider subscribing to our full feed RSS.
|