Tuesday, July 13, 2010

Array Functions (PHP)

I will describe some functions, while we can use it in working with Array.
count(x) = If we write a sequence of variable for x, it will count how many element is in this sequence.
For Example:
$a[4]=10;
$number=count($a);
It will show us how many elements is in this ($a) sequence.
array_pop($sequence) = it is take off the last element of $sequence sequence.
For Example:
$a=array('a','b','c');
echo array_pop($a);
//## c will be in output of this code. It will give to us a last element of this sequence.
array_push($sequence,"elements ") = It is using for adding new elements to the end of the sequence.
For Example:
$a=array("a","b","c");
array_push($a,"d","f");
//## This code add ”d” and “f” to the end of the sequence.

No comments:

Post a Comment