src/Forms/SelectField.php
public function isSelectedValue($dataValue, $userValue)
    {
        if ($dataValue === $userValue) {
            return true;
        }

        // Allow null to match empty strings
        if ($dataValue === '' && $userValue === null) {
            return true;
        }

        // Safety check against casting arrays as strings in PHP>5.4
        if (is_array($dataValue) || is_array($userValue)) {
            return false;
        }

        // For non-falsey values do loose comparison
        if ($dataValue) {
            return $dataValue == $userValue;
        }

        // For empty values, use string comparison to perform visible value match
        return ((string) $dataValue) === ((string) $userValue);
    }
public function isSelectedValue($dataValue, $userValue)
    {
        if ($dataValue === $userValue) {
            return true;
        }

        // Allow null to match empty strings
        if ($dataValue === '' && $userValue === null) {
            return true;
        }

        // Safety check against casting arrays as strings in PHP>5.4
        if (is_array($dataValue) || is_array($userValue)) {
            return false;
        }

        // For non-falsey values do loose comparison
        if ($dataValue) {
            return $dataValue == $userValue;
        }

        // For empty values, use string comparison to perform visible value match
        return ((string) $dataValue) === ((string) $userValue);
    }
public function isSelectedValue ( $ dataValue , $ userValue ) { if ( $ dataValue === $ userValue ) { return true ; } // Allow null to match empty strings if ( $ dataValue === '' && $ userValue === null ) { return true ; } // Safety check against casting arrays as strings in PHP>5.4 if ( is_array ( $ dataValue ) || is_array ( $ userValue ) ) { return false ; } // For non-falsey values do loose comparison if ( $ dataValue ) { return $ dataValue == $ userValue ; } // For empty values, use string comparison to perform visible value match return ( ( string ) $ dataValue ) === ( ( string ) $ userValue ) ; }
Determine if the current value of this field matches the given option value

@param mixed $dataValue The value as extracted from the source of this field (or empty value if available)
@param mixed $userValue The value as submitted by the user
@return boolean True if the selected value matches the given option value
Determine if the current value of this field matches the given option value