public function toFixed($decimals = 2) {

		if(false === ('-' . intval($decimals) == '-' . $decimals)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($decimals)), E_USER_ERROR);
		}

		return $this -> convert(function($number, $decimals) {
			
			$split = explode('.', (string) $number);

			if(count($split) < 2) {
				$split[1] = str_repeat('0', $decimals);
			}

			if(strlen($split[1]) < $decimals) {
				$split[1] .= str_repeat('0', $decimals - strlen($split[1]));
			}

			return rtrim(rtrim($split[0] . '.' . substr($split[1], 0, $decimals), ','), '.');

		}, [$decimals]);
	}
public function toFixed($decimals = 2) {

		if(false === ('-' . intval($decimals) == '-' . $decimals)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($decimals)), E_USER_ERROR);
		}

		return $this -> convert(function($number, $decimals) {
			
			$split = explode('.', (string) $number);

			if(count($split) < 2) {
				$split[1] = str_repeat('0', $decimals);
			}

			if(strlen($split[1]) < $decimals) {
				$split[1] .= str_repeat('0', $decimals - strlen($split[1]));
			}

			return rtrim(rtrim($split[0] . '.' . substr($split[1], 0, $decimals), ','), '.');

		}, [$decimals]);
	}
public function toFixed ( $ decimals = 2 ) { if ( false === ( '-' . intval ( $ decimals ) == '-' . $ decimals ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type integer, "%s" given' , __METHOD__ , gettype ( $ decimals ) ) , E_USER_ERROR ) ; } return $ this -> convert ( function ( $ number , $ decimals ) { $ split = explode ( '.' , ( string ) $ number ) ; if ( count ( $ split ) < 2 ) { $ split [ 1 ] = str_repeat ( '0' , $ decimals ) ; } if ( strlen ( $ split [ 1 ] ) < $ decimals ) { $ split [ 1 ] .= str_repeat ( '0' , $ decimals - strlen ( $ split [ 1 ] ) ) ; } return rtrim ( rtrim ( $ split [ 0 ] . '.' . substr ( $ split [ 1 ] , 0 , $ decimals ) , ',' ) , '.' ) ; } , [ $ decimals ] ) ; }
Converts number into a string, keeping a specified number of decimal
@param int $decimals
@return sFire\Number\Number
Converts number into a string keeping a specified number of decimal