Re: de String a int
| From: | Juan Jose Sanchez Mesa | Date: | Mon, 27 Nov 2000 15:50:23 +0000 |
| Subject: | Re: de String a int | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-4288@lists.php.net to get a copy of this message | ||
Pues como siempre, una simple mirada al manual nos descubre este apartado:
-------------
number_format
(PHP 3, PHP 4 )
number_format -- Format a number with grouped thousands
Description
string number_format (float number, int decimals, string dec_point, string thousands_sep)
Number_format() returns a formatted version of number. This function accepts either one, two or four parameters (not three):
If only one parameter is given, Number will be formatted without decimals, but with a comma (",") between every group of
thousands.
If two parameters are given, number will be formatted with decimals decimals with a dot (".") in front, and a comma (",") between
every group of thousands.
If all four parameters are given, number will be formatted with decimals decimals, dec_point instead of a dot (".") before the decimals and thousands_sep instead of a comma (",") between every group of thousands.
----------------
Facil, no ?
At 12:28 27/11/2000, you wrote:
Tengo una variable de tipo string con un valor numerico pero necesito transformarla a tipo int, con 2 decimales, como puedo hacer? ya que probé con settype ($variable,"integer"), pero me la muestra igual en pantalla, sin decimales ni nada --------------------------------------------------------------------- Archivo On-line: http://www.phpes.com/ Manual PHP en español: http://www.php.net/manual/es/ Para dar de baja la suscripción, mande un mensaje a: lista-unsubscribe@phpes.com