Arrays in PHP
PHP includes a range of array-specific functions. These functions can help sort, manipulate, and search for information within arrays. The PHP manual contains a complete list of all the array functions, but let's take a look at a few of the more useful ones now:
This function works much like a mini case-insensitive search engine. With it, you can easily see if a value is contained within an array:
This function, which determines how many elements are in an array, has already been briefly mentioned:
$Array=array("http://www.yahoo.com", "http://www.internet.com", "http://www.google.com", "http://www.cnn.com/", "http://www.php.net/");
As expected, this would return five.
One of several different functions to sort arrays, this particular one will sort the elements from lowest to highest (in the case of numerical values) or alphabetically (in the case of string values).
Since we sorted this array before looping through it, the values will be printed out alphabetically, beginning with