Well I think this is more of what we should be seeing these days. Though this article did not state if the class handles (numbers 0), I should look it up and see for my self. and i wonder why it only handles decimals when it's currency....
I needed to be able to convert a percentage used in an interest rate to words. Sometimes the percentage included a decimal. Here is how I accomplished the task:
// See if "point" is located in interest rate $pos = strpos($int_rate, '.'); if ($pos === false) { // No Point $wint_rate = $nw->toWords($int_rate) . " Percent"; } else { //Point exists $arr_int_rate = explode('.', $int_rate); //$arr_int_rate[0] piece1 //$arr_int_rate[1] piece2 $arr_int_rate[1] = rtrim($arr_int_rate[1],'0'); // Trim off trailing 0 $wint_rate1 = $nw->toWords($arr_int_rate[0]); $wint_rate2 = $nw->toWords($arr_int_rate[1]); $wint_rate = $wint_rate1 . " Point " . $wint_rate2 . " Percent"; }