0

ok so i have the following array:

0 - 208533

1 - 208523

2 - 208522

3 - 208572

4 - 208518

5 - 208501

6 - 208534

7 - 208499

All i need is a quick function that'll start the array key at 1 rather than 0.

eg: 1 - 208533 etc

Any ideas?

Thanks!

1 Answer 1

3

Well one quick way to do it is:

array_unshift($array, null); // inject a dummy value at beginning
unset($array[0]); // unset the dummy value, the rest of the keys are preserved
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.