src/JSONObject.php
public static function numberToString($number = NULL)
	{
		if($number === NULL)
		{
			throw new JSONException('Null pointer');
		}
		
		self::testValidity($number);
		
		// Shave off trailing zeros and decimal point, if possible.
		$number = (string) $number;
		if(strpos($number, '.') > 0 && strpos($number, 'e') < 0 && strpos($number, 'E') < 0)
		{
			while(substr($number, -1) == '0')
			{
				$number = substr(0, strlen($number) - 1);
			}
			
			if(substr($number, -1) == '.')
			{
				$number = substr(0, strlen($number) - 1);
			}
		}
		
		return $number;
	}
public static function numberToString($number = NULL)
	{
		if($number === NULL)
		{
			throw new JSONException('Null pointer');
		}
		
		self::testValidity($number);
		
		// Shave off trailing zeros and decimal point, if possible.
		$number = (string) $number;
		if(strpos($number, '.') > 0 && strpos($number, 'e') < 0 && strpos($number, 'E') < 0)
		{
			while(substr($number, -1) == '0')
			{
				$number = substr(0, strlen($number) - 1);
			}
			
			if(substr($number, -1) == '.')
			{
				$number = substr(0, strlen($number) - 1);
			}
		}
		
		return $number;
	}
public static function numberToString ( $ number = NULL ) { if ( $ number === NULL ) { throw new JSONException ( 'Null pointer' ) ; } self :: testValidity ( $ number ) ; // Shave off trailing zeros and decimal point, if possible. $ number = ( string ) $ number ; if ( strpos ( $ number , '.' ) > 0 && strpos ( $ number , 'e' ) < 0 && strpos ( $ number , 'E' ) < 0 ) { while ( substr ( $ number , - 1 ) == '0' ) { $ number = substr ( 0 , strlen ( $ number ) - 1 ) ; } if ( substr ( $ number , - 1 ) == '.' ) { $ number = substr ( 0 , strlen ( $ number ) - 1 ) ; } } return $ number ; }
Produce a string from a number.

@param number A number
@return A string.
@throws JSONException If $number is a non-finite number.
Produce a string from a number .