wp_exif_frac2dec( string $str )

Convert a fraction string to a decimal.


Parameters Parameters

$str

(string) (Required)


Top ↑

Return Return

(int|float)


Top ↑

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


Top ↑

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.