Arrays

Populate (fill) an index array with numbers

Array
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 4
    [4] => 5
    [5] => 6
    [6] => 7
    [7] => 8
    [8] => 9
    [9] => Brian Lark
    [10] => 1
    [11] => 1.5
)
I=0 Val=1
I=1 Val=2
I=2 Val=3
I=3 Val=4
I=4 Val=5
I=5 Val=6
I=6 Val=7
I=7 Val=8
I=8 Val=9
I=9 Val=Brian Lark
I=10 Val=1
I=11 Val=1.5

Populate an index array with days of the week

Array
(
    [0] => Sun
    [1] => Mon
    [2] => Tue
    [3] => Wed
    [4] => Thu
    [5] => Fri
    [6] => Sat
)

Populate an associative array with book data

Array
(
    [title] => The Grapes of Wrath
    [author] => John Steinbeck
    [published] => 1939
)

Populate a multidimensional associative array with book data

Array
(
    [book1] => Array
        (
            [title] => The Grapes of Wrath
            [author] => John Steinbeck
            [published] => 1939
        )

    [book2] => Array
        (
            [title] => The Trial
            [author] => Franz Kafka
            [published] => 1925
        )

    [book3] => Array
        (
            [title] => The Hobbit
            [author] => J. R. Tolkien
            [published] => 1937
        )

    [book4] => Array
        (
            [title] => Tale of Two Cities
            [author] => Charles Dickens
            [published] => 1859
        )

)
var_dump is a print command for error checking. Prints false where print_r doesn't
Key=book1Val=array(3) {
  ["title"]=>
  string(19) "The Grapes of Wrath"
  ["author"]=>
  string(14) "John Steinbeck"
  ["published"]=>
  string(4) "1939"
}

Key=book2Val=array(3) { ["title"]=> string(9) "The Trial" ["author"]=> string(11) "Franz Kafka" ["published"]=> string(4) "1925" }
Key=book3Val=array(3) { ["title"]=> string(10) "The Hobbit" ["author"]=> string(13) "J. R. Tolkien" ["published"]=> string(4) "1937" }
Key=book4Val=array(3) { ["title"]=> string(18) "Tale of Two Cities" ["author"]=> string(15) "Charles Dickens" ["published"]=> string(4) "1859" }
One
Two
bool(false)
if I forget the title of book3, it is The Hobbit
If I forget the author of book2, it is Franz Kafka