Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Liban Shire
Courses Plus Student 4,147 PointsArray indexing
Quick question about the $_POST and $_GET methods.
Randy did this to index out a element in the $_POST array. $name = $_POST["name"]; $email = $_POST["email"]; $message = $_POST["message"];
why is it not okay to do something like this to index out an element in the array $name = $_POST[0]; // 0th element in the array $email = $_POST[1]; 1st element $message = $_POST[2]; // 2nd element in the array
1 Answer
J.T. Gralka
20,126 Points$_GET and $_POST are associative arrays (dictionaries, technically). And they do not support numerical indexing.