Some PHP array scripts


To give your more practice using arrays, there are some scripts for you to try out. The scripts are amongst the files you downloaded (in the scripts folder). The file you're looking for is called scripts.txt. You can also copy and paste the scripts by clicking on the links below.

Script One - Set up an array and print out the values

Script Two - Set up an array with your own Keys

Script Three - Set up an array with mixed values

Script Four - Assign values to an array: Method Two example

Script Five - Looping round values in an array

Script Six - Looping round values in an array: example 2

Script Seven - Using text as Keys

Script Eight - Looping round an Associative array using For Each

Script Nine - Sorting Arrays (Associative)

Script Ten - Sorting Arrays (Scalar)

In the next section, we'll move on to String Manipulation with PHP.