public function testSimpleNumberToWords()
 {
     $util = new NumberUtil();
     $this->assertEquals('seven', $util->GetWords(7), 'Test words for number 7');
     $this->assertEquals('two hundred and twenty-five', $util->GetWords(225), 'Test words for number 255');
     $this->assertEquals('negative two hundred and twenty-five', $util->GetWords(-225), 'Test words for negative number -255');
     $this->assertEquals('negative two hundred and twenty-five', $util->GetWords(-225), 'Test words for negative number -255');
     $this->assertEquals('five hundred point two five', $util->GetWords(500.25), 'Test words for float 500.25');
     $this->assertEquals('fifty thousand and one', $util->GetWords(50001), 'Test words for large number 50001');
 }
<?php

require_once '../libs/NumberUtil.php';
$number = strip_tags(isset($_REQUEST['number']) ? $_REQUEST['number'] : '');
$numUtil = new NumberUtil();
$result = new stdClass();
$result->number = $number;
try {
    $result->text = $numUtil->GetWords($number);
} catch (Exception $ex) {
    $result->error = $ex->getMessage();
}
echo json_encode($result);