Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

WebReference.com:
How To Create Alternating Row Colors in PHP
Jun 20, 2007 @ 16:12:00

WebReference.com has a simple new tutorial today showing how to create alternating table rows in the output for your application.

Almost every database driven Web site uses alternating row colors when displaying a list of records, a concept used all over the Internet. You've seen it used, you like it, and now you want to do it yourself. But you're not sure how to accomplish it. Well you've come to the right place. I'm going to discuss the basic idea behind achieving this and give some concrete examples demonstrating different ways to implement it.

Their script loops through the information (numbers in their case) and checks, using the modulus operator to check and see which of the CSS styles it should apply to the div. To give a range of possibility, they also show how to do it with a while loop instead of a for to do a little benchmarking of the methods.

tagged: alternate row color table forloop whileloop css alternate row color table forloop whileloop css

Link:

WebReference.com:
How To Create Alternating Row Colors in PHP
Jun 20, 2007 @ 16:12:00

WebReference.com has a simple new tutorial today showing how to create alternating table rows in the output for your application.

Almost every database driven Web site uses alternating row colors when displaying a list of records, a concept used all over the Internet. You've seen it used, you like it, and now you want to do it yourself. But you're not sure how to accomplish it. Well you've come to the right place. I'm going to discuss the basic idea behind achieving this and give some concrete examples demonstrating different ways to implement it.

Their script loops through the information (numbers in their case) and checks, using the modulus operator to check and see which of the CSS styles it should apply to the div. To give a range of possibility, they also show how to do it with a while loop instead of a for to do a little benchmarking of the methods.

tagged: alternate row color table forloop whileloop css alternate row color table forloop whileloop css

Link:

WebDevLogs.com:
BREAK the FOR VS WHILE loop war
Mar 27, 2007 @ 16:37:00

In this new post on Mgccl's blog today, there's a response to these benchmarks from John Walsh concerning which is faster - a for loop or a while loop.

In this new post, Mgccl, he points out two other examples that show that a while loop is always faster than a for loop. To help prove the point, he's also included a screencast where he shows the code he's using to run the benchmarks (several different tests).

His results, matching the results from the other reports, not only shows that the while loop is faster (still only slightly), but also consumes less memory in the process.

tagged: forloop whileloop benchmark statistic screencast forloop whileloop benchmark statistic screencast

Link:

WebDevLogs.com:
BREAK the FOR VS WHILE loop war
Mar 27, 2007 @ 16:37:00

In this new post on Mgccl's blog today, there's a response to these benchmarks from John Walsh concerning which is faster - a for loop or a while loop.

In this new post, Mgccl, he points out two other examples that show that a while loop is always faster than a for loop. To help prove the point, he's also included a screencast where he shows the code he's using to run the benchmarks (several different tests).

His results, matching the results from the other reports, not only shows that the while loop is faster (still only slightly), but also consumes less memory in the process.

tagged: forloop whileloop benchmark statistic screencast forloop whileloop benchmark statistic screencast

Link:

John Walsh's Blog:
PHP Benchmark - For vs While
Mar 26, 2007 @ 20:19:23

John Walsh filled us in on a new set of benchmarks he worked up comparing two of the standard looping structures in PHP - for versus while.

People always ask me what statement is faster, so I've gone ahead and created a benchmark test using Apache's AB Benchmarking tool. There's no reason not to use For either, you can use it with any while statement but While in some cases mean's less lines, but i prefer speed than less lines of code.

He created some simple scripts to perform the tests and ran them through the AB benchmarker to come up with his results - with while just barely edging out the for loop by one millisecond.

tagged: benchmark loop forloop whileloop apache tool millisecond benchmark loop forloop whileloop apache tool millisecond

Link:

John Walsh's Blog:
PHP Benchmark - For vs While
Mar 26, 2007 @ 20:19:23

John Walsh filled us in on a new set of benchmarks he worked up comparing two of the standard looping structures in PHP - for versus while.

People always ask me what statement is faster, so I've gone ahead and created a benchmark test using Apache's AB Benchmarking tool. There's no reason not to use For either, you can use it with any while statement but While in some cases mean's less lines, but i prefer speed than less lines of code.

He created some simple scripts to perform the tests and ran them through the AB benchmarker to come up with his results - with while just barely edging out the for loop by one millisecond.

tagged: benchmark loop forloop whileloop apache tool millisecond benchmark loop forloop whileloop apache tool millisecond

Link:


Trending Topics: