wc_add_number_precision_deep( array $value, bool $round = true )

Add precision to an array of number and return an array of int.


Description Description


Parameters Parameters

$value

(Required) Number to add precision to.

$round

(Optional) Should we round after adding precision?.

Default value: true


Top ↑

Return Return

(int|array)


Top ↑

Source Source

File: includes/wc-core-functions.php

function wc_add_number_precision_deep( $value, $round = true ) {
	if ( ! is_array( $value ) ) {
		return wc_add_number_precision( $value, $round );
	}

	foreach ( $value as $key => $sub_value ) {
		$value[ $key ] = wc_add_number_precision_deep( $sub_value, $round );
	}

	return $value;
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.2.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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