Home » PHP Array Functions

PHP Array Functions

by Online Tutorials Library

PHP Array Functions

PHP provides various array functions to access and manipulate the elements of array. The important PHP array functions are given below.

1) PHP array() function

PHP array() function creates and returns an array. It allows you to create indexed, associative and multidimensional arrays.

Syntax

Example

Output:

Season are: summer, winter, spring and autumn

2) PHP array_change_key_case() function

PHP array_change_key_case() function changes the case of all key of an array.

Note: It changes case of key only.

Syntax

Example

Output:

Array (  [0] => Array ( [0] => 550000 [1] => 250000 )  [1] => Array ( [0] => 200000 ) ) 

4) PHP count() function

PHP count() function counts all elements in an array.

Syntax

Example

Output:

4

5) PHP sort() function

PHP sort() function sorts all the elements in an array.

Syntax

Example

You may also like