PHP Function: Built-in Functions part 1

Array Fuctions –

array() 
The array() function allows you to manually assign values to an array. Here is the syntax of the array() function:
$array_name = array(“val1”, “val2”, “val3”, …);

array_push() 
The array_push() function allows you to add one or more elements to the end of an existing array. Its syntax is
array_push($array_name, “element 1”, “element 2”, …);

array_pop() 
The array_pop() function allows you to take (pop) off the last element of existing array. Its syntax is
array_pop($array_name);

array_unshift() 
The array_unshift() function allows you to add elements to the beginning of an existing array. Its syntax is
array_unshift($array_name, “element 1″, element 2”, …);

array_shift() 
The array_shift() function allows you to take (pop) off the first element of an existing array. Its syntax is
array_shift($array_name);

array_merge() 
The array_merge() function allows you to combine two or more exisitng arrays.            Its syntax is
array_merge($array1, $array2, …);

array_keys() 
The array_keys() function returns an array of all the key names in an existing array.        Its syntax is
array_keys($array_name);

array_values() 
The array_values() function returns an array of all the values in an existing array.          Its syntax is
array_values($array_name);

That’s it for part one. Stay tuned for part two as well as future sections of built-in functions. Next php function: Built-in Functions part 2