acf_format_numerics()ACF 1.0

Convert any numeric strings into their equivalent numeric type. This function will work with both single values and arrays.

No Hooks.

Returns

Mixed.

Usage

acf_format_numerics( $value );
$value(mixed) (required)
Either a single value or an array of values.

acf_format_numerics() code ACF 6.0.4

function acf_format_numerics( $value ) {
	if ( is_array( $value ) ) {
		return array_map(
			function ( $v ) {
				return is_numeric( $v ) ? $v + 0 : $v;
			},
			$value
		);
	}

	return is_numeric( $value ) ? $value + 0 : $value;
}