If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Unless you have some overriding reason that you have to have the values in separate scalar variables, just use the desired array element you need instead of copying values from the array into separate scalar variables. For example, these two code snippets are functionally identical:

The second version is shorter, requires less processing, and makes it immediately obvious where the values being echoed came from (imagine there are 100 lines of code between the array assignments in the first example and where it does the echoing).

Also, a simple way to start the array numbering at 1 instead of 0:

PHP Code:

$data = array(1 => 'foo', 'bar');

"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation