W3cubDocs

/WordPress

wp_exif_frac2dec( string $str )

Convert a fraction string to a decimal.

Parameters

$str

(string) (Required)

Return

(int|float)

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;
}

Changelog

Version Description
2.5.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_exif_frac2dec