Hi!
I have a big problem from long time a go, and no idea how to solve it. I have a variable $html, coming from outside in my page, including a list of hours and some other things. What I want, is to get all the hours +2 (if it is 03:42 to have it 05:42). The only thing to work with, however, is the $html, because the hours come from outside. First, I tried this way:
$input_clock = array("00:", "01:", "02:", "03:","04:", "05:","06:","07:", "08:", "09:", "10:", "11:", "12:", "13:", "14:", "15:", "16:", "17:", "18:", "19:", "20:", "21:", "22:", "23:");
$output_clock = array("02:", "03:","04:", "05:","06:","07:", "08:", "09:", "10:", "11:", "12:", "13:", "14:", "15:", "16:", "17:", "18:", "19:", "20:", "21:", "22:", "23:", "00:", "01:");
$html = str_replace($input_clock, $output_clock, $html);
Then this:
$input_clock = array("/00:/", "/01:/", "/02:/", "/03:/","/04:/", "/05:/","/06:/","/07:/", "/08:/", "/09:/", "/10:/", "/11:/", "/12:/", "/13:/", "/14:/", "/15:/", "/16:/", "/17:/", "/18:/", "/19:/", "/20:/", "/21:/", "/22:/", "/23:/");
$output_clock = array("02:", "03:","04:", "05:","06:","07:", "08:", "09:", "10:", "11:", "12:", "13:", "14:", "15:", "16:", "17:", "18:", "19:", "20:", "21:", "22:", "23:", "00:", "01:");
$html = preg_replace($input_clock, $output_clock, $html);
But in both cases, if the hour is odd I finally get 00:00, and if it is even, I get 01:00, because I got stuck in an everlasting cycle:
For example: 19 -> 21-> 23 -> 01
or:
20 -> 22 -> 00
What am I supposed to do in this situation? Please, help me, if you can.