note 92971 modified in function.number-format by danbrown

From: Date: Mon, 17 Aug 2009 18:26:08 +0000
Subject: note 92971 modified in function.number-format by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-159572@lists.php.net to get a copy of this message
If you want to use nbsp as decimal/thousand delimiter with UTF-8 you have to replace the whitespace after using number_format: <?php $number = number_format(1000, 0, ".", " "); // normal space echo str_replace(" ", utf8_encode("\xA0"), $number); // or echo str_replace(" ", html_entity_decode("&nbsp;", ENT_COMPAT, "UTF-8"), $number); ?> --was-- If you want to use nbsp as decimal/thousand delimiter with UTF-8 you have to replace the whitespace after using number_format: $number = number_format(1000, 0, ".", " "); // normal space echo str_replace(" ", utf8_encode("\xA0"), $number); // or echo str_replace(" ", html_entity_decode("&nbsp;", ENT_COMPAT, "UTF-8"), $number); http://php.net/manual/en/function.number-format.php

« previous php.notes (#159572) next »