2

Using php, I have populated an array with some data from a .dat-file. It looks like this:

7522126 0   0   0   0   0   0   -419.795    -186.24 1852.86 0.134695    -0.995462   -2.53153
7825452 0   0   0   0   0   0   -419.795    -186.24 1852.86 0.134695    -0.995462   -2.53153
8073799 0   0   0   0   0   0   -345.551    -140.711    1819.04 -0.0220266  -0.85992    -2.29598

The values are each seperated by a tab.

To get every value from a specific column, e.g the 9th column, I've been doing the following:

foreach ($values as $value) {
    echo $value[9];
}

However, I want to be able to get the 9th column only at a specific index. For example the 9th column at index 1. How can I accomplish this?

1
  • means you want 9 index value become 1st index value and 1st will be go to 9th. am i right? Commented Apr 18, 2015 at 13:35

1 Answer 1

5

Something like

echo $values[1][9];

should work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.