<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Exploding and Lists</title> </head> <body> <?php // Here is a very nice array. $arr = array(4, 19, 3, 77, 19, 5); foreach($arr as $x) { echo "$x "; } echo "<br/>"; echo "$arr[2] $arr[0] $arr[3]<br/>\n"; // Here is a way to assign the contents of an array to variables. list($a, $b, $c, $fred, $barney, $sally) = $arr; echo "$a - $b - $c - $fred - $barney - $sally<br/>\n"; // The explode funtion breaks a string up into substrings using a // separator, and returns an array of the parts. $parts = explode(";", "17;bill;alex;22;boo!"); echo "$parts[0] + $parts[1] + $parts[2] + $parts[3] + $parts[4]<br/>\n"; // And, we can use both together. list($a,$b,$c) = explode("<->", "winnie<->billie<->aardvark"); print "[$a] [$b] [$c]<br/>\n"; ?> </body> </html>