function count ()
Describe:
Calculate the number of elements in a variable
int count (mixed Var);
Returns the number of elements in Var, which are typically an array (since anything else would have one element).
Returns 0 If the variable is not set.
Returns 1 If the variable is isn't an array.
function current ()
Describe:
Returns the element that the array pointer is currently referring to
Mixed current (array array);
Each array variable has a internal pointer that points to one of its elements. In addition, the "elements in the" array are linked by a bidirectional linked list for traversing purposes. The internal pointer points to the "the" is inserted to the "array until you run one of the functions" that Mo Dify that pointer on the that array.
The current () function simply returns the "array element that" currently being pointed by the internal pointer. It does the pointer in any way. If the internal pointer points beyond the end of the elements list, current () returns false.
Functions each ()
Describe:
Returns the value of the next pair of Key/value in an array
Array each (array array);
Returns the key/value pair from the array array and advances the array cursor. This pair was returned in a four-element array with the keys 0, 1, key, and value. Elements 0 and key each contain the key name of the array element, and 1 and value contain the data.
Example 1. each () examples
$foo = Array ("Bob", "Fred", "Jussi", "Jouni"); $bar = each ($foo);
$bar now contains the following key/value pairs:
0 => 0
1 => ' Bob '
Key => 0
Value => ' Bob '
$foo = Array ("Robert" => "Bob", "Seppo" => "Sepi"); $bar = each ($foo);
$bar now contains the following key/value pairs:
0 => ' Robert '
1 => ' Bob '
Key => ' Robert '
Value => ' Bob '
Example 2. Traversing $http_post_vars with each ()
echo "Values submitted via POST method:<br>";
while (list ($key, $val) = each ($http_post_vars)) {
echo "$key => $val<br>";
}
Function End ()
Describe:
Moves the pointer in the array to the last
End (array array);
End () advances array ' s internal pointer to the last element.
Function key ()
Describe:
Remove key from an array
Mixed key (array array);
Key () returns the index element of the current array position.
function Ksort ()
Describe:
To arrange an array with key
Example 1. Ksort () example
$fruits = Array ("D" => "Lemon", "a" => "Orange", "B" => "banana", "C" => "Apple");
Ksort ($fruits);
for (Reset ($fruits);
$key = key ($fruits);
Next ($fruits)) {echo "fruits[$key] =". $fruits[$key]. "; }
This example would display:fruits[a] = orange fruits[b] = Banana fruits[c] = apple fruits[d] = lemon
Function List ()
Describe:
To specify the value of a whole string of variables in an array-like manner
Example 1. List () example
<table> <tr> <th> Employee name</th>
<th>Salary</th> </tr>
<?php $result = MySQL ($conn, "SELECT ID, Name, salary from employees");
while (list ($id, $name, $salary) = Mysql_fetch_row ($result)) {
Print ("<tr>".) <td><a href= "Info.php3?id=$id" >$name</a></td> "." <td>$salary</td> "." </tr> ");
}
?>
</table>
function Next ()
Describe:
Pointing the array to the next set of data
function pos ()
Describe:
Returns the current data for the array
Function prev ()
Describe:
Returns data from the previous bar of an array
function Reset ()
Describe:
The pointer to the array points to the first
function Rsort ()
Describe:
Arrange an array in reverse order
Example 1. Rsort () example
$fruits = Array ("Lemon", "orange", "banana", "apple");
Rsort ($fruits);
for (Reset ($fruits); ($key,$value) = each ($fruits); ) {
echo "fruits[$key] =". $value. ";
}
This example would display:fruits[0] = orange fruits[1] = lemon fruits[2] = Banana fruits[3] = Apple fruits have Sorted in reverse alphabetical order.
function sizeof ()
Describe:
Gets the size of an array and the number of elements
function sort ()
Describe:
Sort array
Example 1. Sort () example
$fruits = Array ("Lemon", "orange", "banana", "apple");
Sort ($fruits);
for (Reset ($fruits);
$key = key ($fruits);
Next ($fruits)) {
echo "fruits[$key] =". $fruits[$key]. " ";
}
This example would display:fruits[0] = Apple fruits[1] = banana fruits[2] = lemon fruits[3] = orange The fruits have been Sorted in alphabetical order.
function Uasort ()
Describe:
Arranges an array in a custom manner and the sequence does not change.
function Uksort ()
Describe:
Sort by key in a custom way
This function would sort the keys of an array using a user-supplied comparison function. If the array you are wish to sort needs to is sorted by some non-trivial criteria, you are should use this function. Example 1. Uksort ()