public function createElementOption($key, $desc, $selected = false) {
$option = $this->createElement('option', $desc);
- if ($key) {
+ if (is_numeric($key) || is_string($key)) {
$option->setAttribute('value', $key);
}
- if ($selected) { $option->setAttribute('selected', ''); }
+ if ($selected) {
+ $option->setAttribute('selected', '');
+ }
return $option;
}