[eluser]jedd[/eluser]
It's always so much more challenging when you read a message and have to reverse engineer the
actual problem that someone is trying to solve.
It seems to me that you had one problem - you have a list of 24 numbers that you want to map to a list of 24 strings.
For some reason you then thought you should use regex. Now you have two problems.
So .. assuming all you really want to do is get from this:
Code:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23
to this:
Code:
12am, 1am, 2am, 3am, 4am, 5am, 6am, 7am, 8am, 9am, 10am, 11am, 12pm, 1pm , 2pm, 3pm, 4pm, 5pm, 6pm, 7pm, 8pm, 9pm, 10pm, 11pm
Why don't you just have this:
Code:
$twentyfour = array (
0 => "12am",
1 => "1am",
2 => "2am",
...
23 => "11pm",
);
Cycling through $key, cycling through $value and doing lookups are easy with this array.