Function __global->float_to_raw_string

Definitions

sources/global3.php

  • Convert a float to a "technical string representation of a float". Inverted with floatval.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$num float No No required parameter N/A N/A The number
$decs_wanted integer No No 2 N/A N/A The number of decimals to keep
$only_needed_decs boolean No No False N/A N/A Whether to trim trailing zeros

Returns

  • The string converted
  • Type: string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Convert a float to a "technical string representation of a float". Inverted with floatval.
 *
 * @param  float $num The number
 * @param  integer $decs_wanted The number of decimals to keep
 * @param  boolean $only_needed_decs Whether to trim trailing zeros
 * @return string The string converted
 */

function float_to_raw_string(float $num, int $decs_wanted = 2, bool $only_needed_decs = false) : string