# Array Examples

## Creation by assignment

Array
(
[0] => 1
[1] => 2
[5] => 3
)

## Creation using the array function

Array
(
[0] => 25
[1] => 71
[2] => 36
[3] => 89
[4] => 40
)

Array
(
[Joe] => C
[Sam] => A
[Alice] => B
)

## Adding elements

Array
(
[0] => 25
[1] => 71
[2] => 36
[3] => 89
[4] => 40
[10] => 55
)

Array
(
[Joe] => C
[Sam] => A
[Alice] => B
[Fred] => B
[Sally] => C
)

## Traversing arrays

### Numbers

### Grades

- Joe earns a grade of C
- Sam earns a grade of A
- Alice earns a grade of B
- Fred earns a grade of B
- Sally earns a grade of C

## Sorting arrays

### Sorted Numbers

### Sorted Grades (by grade)

- Joe earns a grade of C
- Sally earns a grade of C
- Fred earns a grade of B
- Alice earns a grade of B
- Sam earns a grade of A

### Sorted Grades (by name)

- Alice earns a grade of B
- Fred earns a grade of B
- Joe earns a grade of C
- Sally earns a grade of C
- Sam earns a grade of A