{"id":660,"date":"2006-08-30T14:48:12","date_gmt":"2006-08-30T11:48:12","guid":{"rendered":"http:\/\/www.mummila.net\/nuudelisoppa\/index.php\/?p=660"},"modified":"2006-08-30T14:48:12","modified_gmt":"2006-08-30T11:48:12","slug":"phps-number_format-with-nbsp","status":"publish","type":"post","link":"https:\/\/mummila.net\/nuudelisoppa\/2006\/08\/30\/phps-number_format-with-nbsp\/","title":{"rendered":"PHP&#39;s number_format() with &nbsp;"},"content":{"rendered":"<p><a href=\"http:\/\/fi.php.net\/number_format\">PHP&#8217;s <code>number_format()<\/code><\/a> can&#8217;t take a <code>&amp;nbsp;<\/code> as a separator, which is bad when you want the separator to be whitespace inside HTML, since using a normal blank (a &#8221;&nbsp;&#8220;) breaks the number when it happens to be laid out between to lines.<\/p>\n<p><a href=\"http:\/\/livedocs.phpdoc.info\/index.php?l=en&amp;q=function.number-format#45678\"><b>Svein Tjonndal<\/b> has written the following little function<\/a> which essentially does a <code>number_format<\/code> with <code>&amp;nbsp;<\/code> as the thousands separator:<\/p>\n<blockquote>\n<p><code><\/p>\n<pre>function numberfix($number)\n {\n   $number = number_format($number,0,\",\",\" \");\n   return str_replace(\" \", \"&nbsp;\", $number);\n }<\/pre>\n<p><\/code><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>PHP&#8217;s number_format() can&#8217;t take a &amp;nbsp; as a separator, which is bad when you want the separator to be whitespace inside HTML, since using a normal blank (a &#8221;&nbsp;&#8220;) breaks the number when it happens to be laid out between to lines. Svein Tjonndal has written the following little function which essentially does a number_format [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-660","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/mummila.net\/nuudelisoppa\/wp-json\/wp\/v2\/posts\/660","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mummila.net\/nuudelisoppa\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mummila.net\/nuudelisoppa\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mummila.net\/nuudelisoppa\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mummila.net\/nuudelisoppa\/wp-json\/wp\/v2\/comments?post=660"}],"version-history":[{"count":0,"href":"https:\/\/mummila.net\/nuudelisoppa\/wp-json\/wp\/v2\/posts\/660\/revisions"}],"wp:attachment":[{"href":"https:\/\/mummila.net\/nuudelisoppa\/wp-json\/wp\/v2\/media?parent=660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mummila.net\/nuudelisoppa\/wp-json\/wp\/v2\/categories?post=660"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mummila.net\/nuudelisoppa\/wp-json\/wp\/v2\/tags?post=660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}