public function getOptionByValue($value)
    {
        // walk all options
        foreach ($this->options as $option) {
            if ($option instanceof Option) {
                if ($option->getValue() == $value) {
                    return $option;
                }
            } else {
                if ($option instanceof Optgroup) {
                    $options = $option->getOptions();
                    foreach ($options as $option2) {
                        if ($option2->getValue() == $value) {
                            return $option2;
                        }
                    }
                }
            }
        }

        return null;
    }
public function getOptionByValue($value)
    {
        // walk all options
        foreach ($this->options as $option) {
            if ($option instanceof Option) {
                if ($option->getValue() == $value) {
                    return $option;
                }
            } else {
                if ($option instanceof Optgroup) {
                    $options = $option->getOptions();
                    foreach ($options as $option2) {
                        if ($option2->getValue() == $value) {
                            return $option2;
                        }
                    }
                }
            }
        }

        return null;
    }
public function getOptionByValue ( $ value ) { // walk all options foreach ( $ this -> options as $ option ) { if ( $ option instanceof Option ) { if ( $ option -> getValue ( ) == $ value ) { return $ option ; } } else { if ( $ option instanceof Optgroup ) { $ options = $ option -> getOptions ( ) ; foreach ( $ options as $ option2 ) { if ( $ option2 -> getValue ( ) == $ value ) { return $ option2 ; } } } } } return null ; }
Return the option which has the given value.
If there are multiple options with the same value, the first will be returned.

@param $value
@return Option
Return the option which has the given value . If there are multiple options with the same value the first will be returned .