Jump to content

Symbol


avo

Recommended Posts

HI thanks i was looking for a date function and found this

works good but i was just curious on what $$ did

[code]function timechange($starttime, $addtime, $add = true) {
        $min = 60;
        $hour = $min * 60;

        $a_time = array('hour', 'min', 'sec');
        $a_addtime = explode(':', $addtime);
        $amount = 0;
        for ($i = 0; $i < count($a_addtime); $i++) {
                $s = $a_time[$i];
                $amount += $$s * $a_addtime[$i];
        }

        $starttime = strtotime($starttime);
        $s = ($add === true) ? date('H:i', $starttime + $amount) : date('H:i', $starttime - $amount);
        return $s;
}[/code]

This will add time to time

[quote]echo timechange('20:50', '01:40');[/quote]

This will minuss time from time

[quote]echo timechange('20:50', '01:40', false);[/quote]

if anyone would like it

Still currious.. ???
Link to comment
https://forums.phpfreaks.com/topic/14113-symbol/#findComment-55276
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.