Jump to content

Starting an array from an x number and relooping back


rbrown

Recommended Posts

I have an array with 40 elements and I want to be able to start at what ever element and have it loop though the array outputting to another array and have it continue back around to the where it started.

 

What is happening is if I set, the "start" at 5, the "count" at 40, and then add "start plus count" together, and loop through using the "start plus count" as the stop number in the for loop, it returns only 35 elements.

 

What do I have to do to get it to loop back around?

 

Thanks,

Link to comment
Share on other sites

Sorry, That's not going to work... I should have told you what the array contains.

 

the keys are alpha numeric and data is numbers. So you can't range the array.

It can look something like this example:

$test_start['Q']='18';$test_start['q']='19';$test_start['P']='20';
$test_start['p']='21';$test_start['O']='22';$test_start['o']='23';
$test_start['N']='24';$test_start['n']='25';$test_start['m']='26';
$test_start['M']='27';$test_start['L']='28';$test_start['l']='29';
$test_start['k']='30';$test_start['K']='31';$test_start['j']='32';
$test_start['J']='33';$test_start['I']='34';$test_start['i']='35';
$test_start['h']='37';$test_start['<']='55';$test_start['+']='56';
$test_start['~']='57';$test_start['}']='58';$test_start['{']='59';
$test_start['`']='60';$test_start['_']='61';$test_start['^']='62';
$test_start[']']='63';$test_start['[']='64';$test_start['@']='65';
$test_start['?']='66';$test_start[':']='67';$test_start['.']='69';
$test_start[',']='70';$test_start['*']='71';$test_start[')']='72';

etc...

 

So how do I do it with that type of data?

Thanks,

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.