Archive for December, 2007
Simple FOR() Loops
One of the most common programming functions we need to use in PHP is the simple FOR() loop, which repeats a particular section of code several times. You can make it repeat the code of fixed number of times, or just keep looping through until a particular condition is met. Here is the basic format:
for [...]
Filed under: Functions | Leave a Comment
Get The Info – PHPinfo
Oftentimes, when you want to install a PHP powered program or function on your website, such as WordPress blog software, or a traffic tracking routine, or tens of thousands of other useful things out there written in PHP, they usually include ‘requires xxx’ where xxx might be about anything supported by PHP. Sometimes it is [...]
Filed under: Functions | Leave a Comment
301 Redirect in PHP
Whenever you remove content from your website, you should use a 301 redirect to show the search engines that the content has been permanently relocated. If you have content relevant to that removed, point the 301 redirect to that content instead. If you do not, just point it to your home page.
Any visitors who find [...]
Filed under: Redirects | Leave a Comment
Just Include It
When you design a website, it is always best to separate out the content from the display control elements. Mostly, that is done with CSS, which allows you to control the appearance of your site from a single file.
But if you are making a dynamic site with PHP power — using a database perhaps, or [...]
Filed under: Websites | Leave a Comment
Randomizing with RAND and SRAND
Random numbers have been an important goal of computing since the computer was invented. We often have a need for selecting amongst a number of elements one or more at random. Computers, surprisingly, can’t really do that — but they come so close that the difference is of no consequence to anyone but mathematicians.
For a [...]
Filed under: Functions | Leave a Comment
Search
-
You are currently browsing the PHP Basics weblog archives for the month December, 2007.