Arrays

Define an array

Array ( [0] => onion [1] => tomato [2] => cheese [3] => anchovies [4] => ham [5] => pepperoni )

Define an associative array or "hash table"

Array ( [red] => apple [yellow] => banana [purple] => plum [green] => grape )

Explode function will turn a normal variable in to an array using a delimiter to seperate each element

Array ( [0] => red [1] => blue [2] => green [3] => yellow )

Push and pop can add and remove the last element in an array

Array ( [0] => spaghetti [1] => penne [2] => tagliatelle ) Array ( [0] => vermechelly [1] => penne [2] => tagliatelle )



Source code: