Guest Posted April 30, 2010 Share Posted April 30, 2010 No, I haven't. Have you tried anything on your own? Yes i have, but no success yet... :( Link to comment Share on other sites More sharing options...
Guest Posted April 30, 2010 Share Posted April 30, 2010 I got one script what must work but i get one error - [b]Fatal error: Function name must be a string in /var/www/sapnis/panelis/new_n2w.php on line 24[/b] any clues? the script is HERE Link to comment Share on other sites More sharing options...
♥mdtaylorlrim Posted April 30, 2010 Share Posted April 30, 2010 This line... return $saya[$tmp*10].' '.$saya($num-$tmp*10); Probably should be this... return $saya[$tmp*10].' '.$saya[$num-$tmp*10]; Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...? Link to comment Share on other sites More sharing options...
Guest Posted April 30, 2010 Share Posted April 30, 2010 This line... return $saya[$tmp*10].' '.$saya($num-$tmp*10); Probably should be this... return $saya[$tmp*10].' '.$saya[$num-$tmp*10]; the error is gone, but it seems this script dose not work correctly... Link to comment Share on other sites More sharing options...
Guest Posted April 30, 2010 Share Posted April 30, 2010 Found another one! This almost perfect, but it dose not handle numbers above 10999.99 all other numbers are processed fine! IF the number is 11000.00 number to words: eleven thousand one hundred lats, 00/100 santims - the RED marked part shouldn't be there, also the same with numbers 1200.00 etc. First got some problem with hundreds and thousands, but i managed to repair that! now it would be great if you helped me a bit with numbers till 999999.99 so this will help other who want`s to use this in there shops in future! Here is the code: <?php $numb = array('nulle', 'viens', 'divi', 'trīs', 'četri', 'pieci', 'seši', 'septiņi', 'astoņi', 'deviņi', 'desmit'); $tens = array('', 'vien', 'div', 'trīs', 'četr', 'piec', 'seš', 'septiņ', 'astoņ', 'deviņ'); $bigones = array(100 => 'simti', 1000 => 'tulkstoši', 1000000 => 'miljoni', 1000000000 => 'miljardi'); function toWords($num){ global $numb, $tens, $bigones, $santimes; $num = number_format($num, 2, '.', ''); $numParts = explode('.', $num); if ($numParts[1] > 0){ // $santString = tenWords($numParts[1]) . (($numParts[1] % 10 == 1 && $numParts[1] != 11) ? 'santīms ' : 'santīmi '); $santString = $numParts[1] . (($numParts[1] % 10 == 1 && $numParts[1] != 11) ? '/100 santīms ' : '/100 santīmi '); }else{ $santString = '0/100 santīmi'; } $thousands = floor($numParts[0] / 1000); $lsString = ''; if (!empty($thousands)){ $lsString = tenWords($thousands) . (($thousands % 10 == 1 && $thousands != 11) ? ' tūkstots ' : 'tūkstoši '); } $hundreds = substr(floor($numParts[0] / 100), 1, 1); if (!empty($hundreds)){ $lsString .= $numb[$hundreds] . ($hundreds % 10 == 1 ? ' simts ' : ' simti '); } else { $hundreds = substr(floor($numParts[0] / 100), -1, 1); if (!empty($hundreds)){ $lsString .= $numb[$hundreds] . ($hundreds % 10 == 1 ? ' simts ' : ' simti '); } } $tenLats = substr($numParts[0], -2); if ($tenLats < 100){ $lsString .= tenWords($tenLats) . (($tenLats % 10 == 1 && $tenLats != 11) ? 'lats,' : 'lati,'); } $text = $lsString . ' ' . $santString; return $text; } function tenWords($num){ global $tens, $numb; if ($num > 19){ $firstDigit = substr($num, 0, 1); $secondDigit = substr($num, 1, 1); return $tens[$firstDigit] . 'desmit ' . $numb[$secondDigit] . ' '; }elseif($num <= 19 AND $num > 10){ return $tens[$num % 10] . 'padsmit '; }elseif($num <= 10){ return $numb[(int)$num] . ' '; } } ?> p.s. if u need translation help just ask! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.