PHP code example of misbah / money-in-words

1. Go to this page and download the library: Download misbah/money-in-words library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

misbah / money-in-words example snippets




  
  er = new \MoneyInwords\MoneyInWords();

  $number = 1.03;

  print_r($converter->numberToWords($number));
  echo "<br>";

  $number = 0.1;
  print_r($converter->numberToWords($number));
  echo "<br>";

  $number = 3125639562;
  var_dump($converter->numberToWords($number));

/* Outputs
Array ( [0] => one [1] => three ) 
Array ( [0] => twelve crore sixty five lac forty three thousand nine hundred and eighty one [1] => ten ) 
array(2) { [0]=> string(12) "ten thousand" [1]=> string(0) "" }
*/




  
  er = new \MoneyInwords\MoneyInWords();

  $number = 1.03;
  print_r(ucwords($converter->moneyToWords($number)));
  echo "<br>";

  $number = 0.1;
  print_r(ucwords($converter->moneyToWords($number)));
  echo "<br>";

  $number = 3125639562;
  print_r(ucwords($converter->moneyToWords($number)));


/* Outputs
One Taka And Three Paisa
Zero Taka And Ten Paisa
Three Hundred And Twelve Crore Fifty Six Lac Thirty Nine Thousand Five Hundred And Sixty Two Taka
*/