Topic: Shorter Timezone script?

                            <?php
                            $timestamps = array(-12, -11, -10, -9.5, -9, -8.5, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 13, 14);
                            $tloc = array(-8 => ' PST', -7 => ' MST', -6 => ' CST', -5 => ' EST', -4 => ' AST', -3 => ' ADT', 0 => ' GMT', 1 => ' CET');
                            foreach( $timestamps as $stamp )
                            {
                                $selected = $user['timezone'] == $stamp ? ' selected="selected"' : '';
                                $loc = isset($tloc[ $stamp ]) ? $tloc[ $stamp ] : '';
                                echo str_repeat("\t", 7) . "<option value=\"{$stamp}\"{$selected}>{$stamp}{$loc}</option>\n";
                            }
                            ?>

wink  Shorter

Re: Shorter Timezone script?

Shorter, yes, but that code (at least for me) is more difficult to read and understand.
Also, I don't think you've seen this changeset:
http://dev.punbb.org/changeset/1505

3 (edited by Lamonte 2008-03-26 18:50)

Re: Shorter Timezone script?

No haven't seen it lately, and I understand smile..Nice lil update smile