PHP programming tutorials

PHP: Break apart strings with explode

contributed by Rex on September 19, 2004 under PHP programming

PHP has a wonderful built-in function to break apart a string using substring separators. This recipe describes the use of the explode() function.

 

Redirect to another web page using PHP

contributed by qmchenry on June 9, 2004 under PHP programming

Redirection from one web page to another is a handy tool. This recipe describes the syntax that causes the client to redirect to another URL.

 

PHP conditional syntax: using switch and case statements

contributed by qmchenry on March 20, 2004 under PHP programming

The switch/case statement offers similar functionality to the if/elseif statement, although it offers a more elegant solution and has capabilities beyond the if/elseif alternative.

 

PHP syntax: for loop basics

contributed by qmchenry on February 1, 2004 under PHP programming

The for loop allows iteration a fixed number of times.

 

PHP: determine the directory path of the server root

contributed by qmchenry on January 4, 2004 under PHP programming

It is sometimes necessary to refer to files in the host filesystem explicitly. By retrieving this information dynamically instead of hard coding it, moving the code from one server or hosting company to another is much simpler.

 

PHP syntax: Three Comment Styles

contributed by qmchenry on December 28, 2003 under PHP programming

PHP allows three forms of comments all of which may seem familiar to programmers of other languages.

 

PHP syntax: sort an associative array by value with asort

contributed by qmchenry on under PHP programming

To sort an associative array by the array values, use asort.

 

PHP syntax: sort an associative array by index keys

contributed by qmchenry on under PHP programming

To sort an associative array by index values (or keys), use ksort.