A lot of the gripes about PHP as a language come down to the fact that there are a million ways to accomplish the same task, but only a couple are truely 'correct' - as in significantly better for one reason or another. Out of all those reasons script efficiency and speed are the driving force behind all experienced programmers.  That being said it's hard to know what the right way to do things are. Sure there are 100 ways to do something but all but 2 or 3 of those take an obscene amount of time. Normally, during development, you won't notice long load times because it's not getting hammered by thousands of users requesting the same page.

Chris Vincent has set up The PHP Benchmark to help visually show how some methods are more effecient than others.

PHPBench.com was constructed as a way to open people's eyes to the fact that not every PHP code snippet will run at the same speed.

A few highlights:

<?php
foreach($aHash as $val);
// VS
while(list(,$val) = each($aHash));
?>

  • foreach($array as $value) is the fastest way to loop through an array.
  • foreach($array as $key => $value) is slightly slower by about 10-15% so use it only when necassary.
  • Using while() and for() loops dramatically increases the server load especially when used in conjuction with list() and each().

-Read More

Richard O'Neill has written a short article on improving user-interface by polishing-up your grids and tables. By making a few simple modifications your information can be easily read and understood.

"It's not hard making interfaces look professional. I've found that some good looking icons and a bit of cell padding makes all the difference.
Using the example below, we can apply small changes to the design which will improve usability and make this ugly interface look a lot better."

 Making Your Tables Easier on the Eyes

-Read More

Creating a way to show how many users are currently visiting your website has become a fad amongst webmasters. It's a cool way to show off your skills has a coder and to show your visitors how many other people are looking at the same thing they are. You don't want to miss the bandwagon again do you? This script is also an excuse to brush up on some mildly advanced MySQL queries.

-Read More

.htaccess files are one of the most underused and underrated forms of web development. They are very easily overlooked or dismissed as unimportant by the amateur programmer. The reality of it is that .htaccess has some of the coolest and ridiculously easy features to offer.

-Read More

The most useful and almost necessary feature of any interactive website is a registration form. A way to give users access to features while keeping out the riff-raff. While a registration script can be the perfect time for an amateur to grab the bull by the horns it can also leave lots of pitfalls for a more experienced programmer.

-Read More

rssProviding RSS Feeds for your website is fast becoming a necessity in today's web2.0 world. The amount of surfers taking advantage of everything RSS Feeds has to offer has exploded in recent history, and it's easy to see why. The amount gained from offering a RSS Feed far outweigh the effort needed to create one.

-Read More

< 1 2 3

4

5 >