wc_selected()WC 1.0

Return the html selected attribute if stringified $value is found in array of stringified $options or if stringified $value is the same as scalar stringified $options.

No Hooks.

Return

String.

Usage

wc_selected( $value, $options );
$value(string|int) (required)
Value to find within options.
$options(string|int|array) (required)
Options to go through when looking for value.

wc_selected() code WC 8.6.1

function wc_selected( $value, $options ) {
	if ( is_array( $options ) ) {
		$options = array_map( 'strval', $options );
		return selected( in_array( (string) $value, $options, true ), true, false );
	}

	return selected( $value, $options, false );
}