{"id":657,"date":"2012-10-25T03:33:54","date_gmt":"2012-10-25T03:33:54","guid":{"rendered":"http:\/\/codeatelier.wordpress.com\/?p=351"},"modified":"2012-10-25T03:33:54","modified_gmt":"2012-10-25T03:33:54","slug":"number-to-word-conversion-php","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/number-to-word-conversion-php\/","title":{"rendered":"Number to Word Conversion PHP"},"content":{"rendered":"<pre>\n    function no_to_words($no)\n    {\n    $words = array('0'=&gt; '' ,'1'=&gt; 'one' ,'2'=&gt; 'two' ,'3' =&gt; 'three','4' =&gt; 'four','5' =&gt; 'five','6' =&gt; 'six','7' =&gt; 'seven','8' =&gt; 'eight','9' =&gt; 'nine','10' =&gt; 'ten','11' =&gt; 'eleven','12' =&gt; 'twelve','13' =&gt; 'thirteen','14' =&gt; 'fouteen','15' =&gt; 'fifteen','16' =&gt; 'sixteen','17' =&gt; 'seventeen','18' =&gt; 'eighteen','19' =&gt; 'nineteen','20' =&gt; 'twenty','30' =&gt; 'thirty','40' =&gt; 'fourty','50' =&gt; 'fifty','60' =&gt; 'sixty','70' =&gt; 'seventy','80' =&gt; 'eighty','90' =&gt; 'ninty','100' =&gt; 'hundred &amp;','1000' =&gt; 'thousand','100000' =&gt; 'lakh','10000000' =&gt; 'crore');\n    if($no == 0)\n    return ' ';\n    else {\n    $novalue='';\n    $highno=$no;\n    $remainno=0;\n    $value=100;\n    $value1=1000;\n    while($no&gt;=100) {\n    if(($value &lt;= $no) &amp;&amp;($no &lt; $value1)) {\n    $novalue=$words[&quot;$value&quot;];\n    $highno = (int)($no\/$value);\n    $remainno = $no % $value;\n    break;\n    }\n    $value= $value1;\n    $value1 = $value * 100;\n    }\n    if(array_key_exists(&quot;$highno&quot;,$words))\n    return $words[&quot;$highno&quot;].&quot; &quot;.$novalue.&quot; &quot;.no_to_words($remainno);\n    else {\n    $unit=$highno%10;\n    $ten =(int)($highno\/10)*10;\n    return $words[&quot;$ten&quot;].&quot; &quot;.$words[&quot;$unit&quot;].&quot; &quot;.$novalue.&quot; &quot;.no_to_words($remainno);\n    }\n    }\n    }\n    echo no_to_words(12345401);\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>function no_to_words($no) { $words = array(&#8216;0&#8217;=&gt; &#8221; ,&#8217;1&#8217;=&gt; &#8216;one&#8217; ,&#8217;2&#8217;=&gt; &#8216;two&#8217; ,&#8217;3&#8242; =&gt; &#8216;three&#8217;,&#8217;4&#8242; =&gt; &#8216;four&#8217;,&#8217;5&#8242; =&gt; &#8216;five&#8217;,&#8217;6&#8242; =&gt; &#8216;six&#8217;,&#8217;7&#8242; =&gt; &#8216;seven&#8217;,&#8217;8&#8242; =&gt; &#8216;eight&#8217;,&#8217;9&#8242; =&gt; &#8216;nine&#8217;,&#8217;10&#8217; =&gt; &#8216;ten&#8217;,&#8217;11&#8217; =&gt; &#8216;eleven&#8217;,&#8217;12&#8217; =&gt; &#8216;twelve&#8217;,&#8217;13&#8217; =&gt; &#8216;thirteen&#8217;,&#8217;14&#8217; =&gt; &#8216;fouteen&#8217;,&#8217;15&#8217; =&gt; &#8216;fifteen&#8217;,&#8217;16&#8217; =&gt; &#8216;sixteen&#8217;,&#8217;17&#8217; =&gt; &#8216;seventeen&#8217;,&#8217;18&#8217; =&gt; &#8216;eighteen&#8217;,&#8217;19&#8217; =&gt; &#8216;nineteen&#8217;,&#8217;20&#8217; =&gt; &#8216;twenty&#8217;,&#8217;30&#8217; =&gt; &#8216;thirty&#8217;,&#8217;40&#8217; =&gt; &#8216;fourty&#8217;,&#8217;50&#8217; =&gt; &#8216;fifty&#8217;,&#8217;60&#8217; =&gt;&hellip; <a href=\"https:\/\/codethataint.com\/blog\/number-to-word-conversion-php\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-657","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/657","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=657"}],"version-history":[{"count":0,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/657\/revisions"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=657"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=657"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}