CodeIgniter Forums
Basic - How do I read this array? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Basic - How do I read this array? (/thread-46533.html)



Basic - How do I read this array? - El Forum - 11-04-2011

[eluser]TerryT[/eluser]
I am retrieving data from a multi_select on a form using this:

Code:
$project_data = array('projects' => $this->input->post('projects'));

The xdebug shows the result as:

$project_data = array
projects = array
[0] = 2
[1] = 3
[5] = 5

2, 3 and 5 are the number of my projects from the multi_select. How do I step through the array and read the values 2, 3 and 5? The projects array could have any number of projects from 1 to 99 determined when the user makes the selection.

I know it should be simple, but I haven't been able to get it. Thanks.