Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
base system
Priority:
Minor
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
18 Jul 2007 at 06:19 UTC
Updated:
3 Dec 2008 at 12:12 UTC
Isn't it bad code style if i surround integers with quotes? This is out of D6 systems.module
$form['admin_theme'] = array(
'#type' => 'select',
'#options' => $options,
'#title' => t('Administration theme'),
'#description' => t('Choose which theme the administration pages should display in. If you choose "System default" the administration pages will use the same theme as the rest of the site.'),
'#default_value' => variable_get('admin_theme', '0'),
);
$form['node_admin_theme'] = array(
'#type' => 'checkbox',
'#title' => t('Use administration theme for content editing'),
'#description' => t('Use the administration theme when editing existing posts or creating new ones.'),
'#default_value' => variable_get('node_admin_theme', '0'),
);
Looks better:
$form['admin_theme'] = array(
'#type' => 'select',
'#options' => $options,
'#title' => t('Administration theme'),
'#description' => t('Choose which theme the administration pages should display in. If you choose "System default" the administration pages will use the same theme as the rest of the site.'),
'#default_value' => variable_get('admin_theme', 0),
);
$form['node_admin_theme'] = array(
'#type' => 'checkbox',
'#title' => t('Use administration theme for content editing'),
'#description' => t('Use the administration theme when editing existing posts or creating new ones.'),
'#default_value' => variable_get('node_admin_theme', 0),
);
Comments
Comment #1
chx commentedComment #2
hass commentedwhy are you not commenting on this code examples?
Comment #3
jody lynnComment #4
jody lynnComment #5
hass commentedAny comment on the above code style?
Comment #6
jody lynnComment: If it's so important to you, then submit a patch.
Comment #7
hass commentedI'm not talking about - if there should be a patch or not - it's more about what is faster and correct code.
So changing to support request for now.
Comment #8
ainigma32 commentedI don't think that there is a big difference in speed in using the one or the other. Both options use the same function, both values get serialized. The option using an integer will use less storage i:1; = 4 + 2 = 6 bytes vs s:1:"1"; = 8 + 2 = 10 bytes but these differences are negligible.
As to what's correct; that is a matter of opinion. Personally I think it doesn't really matter what you choose as long as you do it consistently.
And finally I would like to suggest that these matters are taken care of on IRC or in one of the forums. It seems to me that this is not the correct place to do this ;-)
- Arie
Comment #9
ainigma32 commented