{"id":8590,"date":"2021-08-23T23:48:07","date_gmt":"2021-08-23T20:48:07","guid":{"rendered":"https:\/\/elzero.org\/?p=8590"},"modified":"2022-08-07T07:01:45","modified_gmt":"2022-08-07T04:01:45","slug":"php-problems-solving-add-commas-and-underscores-to-number","status":"publish","type":"post","link":"https:\/\/elzero.org\/old\/php-problems-solving-add-commas-and-underscores-to-number\/","title":{"rendered":"Add Commas And Underscores To Number"},"content":{"rendered":"<h3>\u0627\u0644\u062d\u0644<\/h3>\r\n\r\n<script type=\"text\/plain\" class=\"language-php\">\r\n\/\/ PHP Version 7.4.22 \r\n\r\nfunction add_commas_and_underscore($num) {\r\n  $result = number_format($num);\r\n  if (strlen($result) > 3) {\r\n    $result[-4] = \"_\";\r\n  }\r\n  return $result . \"<br \/>\";\r\n}\r\n\r\necho add_commas_and_underscore(120); \/\/ 120\r\necho add_commas_and_underscore(1530); \/\/ 1_530\r\necho add_commas_and_underscore(120510650); \/\/ 120,510_650\r\necho add_commas_and_underscore(510650480910); \/\/ 510,650,480_910\r\necho add_commas_and_underscore(12069057014032); \/\/ 12,069,057,014_032\r\n<\/script>","protected":false},"excerpt":{"rendered":"<p>Add Commas And Underscores To Number With PHP<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1337],"tags":[],"class_list":["post-8590","post","type-post","status-publish","format-standard","hentry","category-problems-solving"],"_links":{"self":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8590","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/comments?post=8590"}],"version-history":[{"count":1,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8590\/revisions"}],"predecessor-version":[{"id":8591,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/posts\/8590\/revisions\/8591"}],"wp:attachment":[{"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/media?parent=8590"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/categories?post=8590"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elzero.org\/old\/wp-json\/wp\/v2\/tags?post=8590"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}