wp_exif_frac2dec

Advertisement

Summery Summery

Convert a fraction string to a decimal.

Syntax Syntax

wp_exif_frac2dec( string $str )

Parameters Parameters

$str

(Required)

Return Return

(int|float)

Source Source

File: wp-admin/includes/image.php

function wp_exif_frac2dec( $str ) {
	if ( false === strpos( $str, '/' ) ) {
		return $str;
	}

	list( $numerator, $denominator ) = explode( '/', $str );
	if ( ! empty( $denominator ) ) {
		return $numerator / $denominator;
	}
	return $str;
}

Advertisement

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Advertisement

Leave a Reply