public function getSigFigs($n)
    {
        $n = ltrim($n, '0+-');
        $dp = strpos($n, '.'); // decimal position
        if ($dp === false) {
            $sigfigs = strlen(rtrim($n, '0'));
        } else {
            $sigfigs = strlen(ltrim($n, '0.')); // eliminate extra decimal character
            if ($dp !== 0) {
                $sigfigs--;
            }
        }
        return $sigfigs;
    }
public function getSigFigs($n)
    {
        $n = ltrim($n, '0+-');
        $dp = strpos($n, '.'); // decimal position
        if ($dp === false) {
            $sigfigs = strlen(rtrim($n, '0'));
        } else {
            $sigfigs = strlen(ltrim($n, '0.')); // eliminate extra decimal character
            if ($dp !== 0) {
                $sigfigs--;
            }
        }
        return $sigfigs;
    }
public function getSigFigs ( $ n ) { $ n = ltrim ( $ n , '0+-' ) ; $ dp = strpos ( $ n , '.' ) ; // decimal position
 if ( $ dp === false ) { $ sigfigs = strlen ( rtrim ( $ n , '0' ) ) ; } else { $ sigfigs = strlen ( ltrim ( $ n , '0.' ) ) ; // eliminate extra decimal character
 if ( $ dp !== 0 ) { $ sigfigs -- ; } } return $ sigfigs ; }
Returns the number of significant figures in a string number.
@param string $n Decimal number
@return int number of sigfigs
Returns the number of significant figures in a string number .